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 --- dlls/winemac.drv/cocoa_window.h | 1 + dlls/winemac.drv/cocoa_window.m | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_window.h b/dlls/winemac.drv/cocoa_window.h index d04961f8251..9a8bbb5e255 100644 --- a/dlls/winemac.drv/cocoa_window.h +++ b/dlls/winemac.drv/cocoa_window.h @@ -36,6 +36,7 @@ @interface WineWindow : NSPanel <NSWindowDelegate> BOOL pendingOrderOut; BOOL savedVisibleState; BOOL drawnSinceShown; + BOOL closing; WineWindow* latentParentWindow; NSMutableArray* latentChildWindows;
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index d0672b7fb06..10524e4b3a2 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -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]; });