macOS: Don't deliver events via NSWindow for deleted QCococaWindows

Change-Id: Icb3794f37c929019de1e997e15f7d975492224c2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Tor Arne Vestbø 2017-07-06 15:09:50 +02:00
parent 7f269a5db8
commit b282d11873

View File

@ -114,6 +114,14 @@ static bool isMouseEvent(NSEvent *ev)
- (void)handleWindowEvent:(NSEvent *)theEvent
{
// We might get events for a NSWindow after the corresponding platform
// window has been deleted, as the NSWindow can outlive the QCocoaWindow
// e.g. if being retained by other parts of AppKit, or in an auto-release
// pool. We guard against this in QNSView as well, as not all callbacks
// come via events, but if they do there's no point in propagating them.
if (!self.platformWindow)
return;
[self.window superSendEvent:theEvent];
if (!self.platformWindow)