From 942675f12b5052997f0cc6d9c908b92bd1a7d593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 20 Apr 2017 16:41:39 +0200 Subject: [PATCH] macOS: Guard on platform window instead of window delegate in QNSWindowHelper The platform window is cleared in detachFromPlatformWindow, just like the delegate, but the platform window may be cleared due to other reasons as well, so use that as a guard before calling functions on the pw. Change-Id: Ie0773182073d4932b2bca8bc0fc8af24b8895a9d Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index d963061ae9..b2a434b550 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -187,8 +187,8 @@ static void qt_closePopups() if (!windowStillAlive) return; - if (!self.window.delegate) - return; // Already detached, pending NSAppKitDefined event + if (!self.platformWindow) + return; // Platform window went away while processing event if (pw && pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) { NSPoint loc = [theEvent locationInWindow];