winemac: Don't try to update when the window is closing.

This can happen after the window surface has been destroyed.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52231
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2022-01-04 14:35:03 +00:00 committed by Alexandre Julliard
parent 4fcd040d90
commit 6bb537c8b0
2 changed files with 5 additions and 2 deletions

View File

@ -36,6 +36,7 @@ @interface WineWindow : NSPanel <NSWindowDelegate>
BOOL pendingOrderOut;
BOOL savedVisibleState;
BOOL drawnSinceShown;
BOOL closing;
WineWindow* latentParentWindow;
NSMutableArray* latentChildWindows;

View File

@ -381,6 +381,7 @@ @interface WineWindow ()
@property (readwrite, nonatomic) BOOL noActivate;
@property (readwrite, nonatomic) BOOL floating;
@property (readwrite, nonatomic) BOOL drawnSinceShown;
@property (readwrite, nonatomic) BOOL closing;
@property (readwrite, getter=isFakingClose, nonatomic) BOOL fakingClose;
@property (retain, nonatomic) NSWindow* latentParentWindow;
@ -492,7 +493,7 @@ - (void) updateLayer
if ([window contentView] != self)
return;
if (!window.surface || !window.surface_mutex)
if (window.closing || !window.surface || !window.surface_mutex)
return;
pthread_mutex_lock(window.surface_mutex);
@ -941,7 +942,7 @@ @implementation WineWindow
static WineWindow* causing_becomeKeyWindow;
@synthesize disabled, noActivate, floating, fullscreen, fakingClose, latentParentWindow, hwnd, queue;
@synthesize disabled, noActivate, floating, fullscreen, fakingClose, closing, latentParentWindow, hwnd, queue;
@synthesize drawnSinceShown;
@synthesize surface, surface_mutex;
@synthesize shapeChangedSinceLastDraw;
@ -3232,6 +3233,7 @@ void macdrv_destroy_cocoa_window(macdrv_window w)
WineWindow* window = (WineWindow*)w;
OnMainThread(^{
window.closing = TRUE;
[window doOrderOut];
[window close];
});