From 7ba0eb5a0daae59c495bbf250fa37a2627950e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 21 May 2014 11:30:54 +0200 Subject: [PATCH] Cocoa: Prevent crash on QWindow delete. Clear the QCocoaWindow pointer stored on the QNSWindowHelper when detaching from the platform window. This makes sure callbacks from cocoa does not try access deleted Qt window objects. Task-number: QTBUG-39141 Change-Id: I4672eae92940dcbd59a2848e56f94b50a828bbf6 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 651fedb26e..13e8dde012 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -182,6 +182,7 @@ static bool isMouseEvent(NSEvent *ev) - (void)detachFromPlatformWindow { + _platformWindow = 0; [self.window.delegate release]; self.window.delegate = nil; }