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

Alexandre Julliard julliard at winehq.org
Tue Jan 4 16:20:01 CST 2022


Module: wine
Branch: master
Commit: 6bb537c8b0c5a178665ef0b8c1f38d9c746d9c3b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6bb537c8b0c5a178665ef0b8c1f38d9c746d9c3b

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Jan  4 14:35:03 2022 +0000

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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 @@
     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 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
 @property (readwrite, nonatomic) BOOL noActivate;
 @property (readwrite, nonatomic) BOOL floating;
 @property (readwrite, nonatomic) BOOL drawnSinceShown;
+ at property (readwrite, nonatomic) BOOL closing;
 @property (readwrite, getter=isFakingClose, nonatomic) BOOL fakingClose;
 @property (retain, nonatomic) NSWindow* latentParentWindow;
 
@@ -492,7 +493,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
         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 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
 
     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];
     });




More information about the wine-cvs mailing list