diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-07-06 15:09:50 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-07-06 18:26:38 +0000 |
commit | b282d11873c089a1eddbb01e97ab6ac60b7dcf28 (patch) | |
tree | 0c8c0d07be3cd288d75b1a3b03da889d50e9a9f1 /src/plugins/platforms/cocoa/qnswindow.mm | |
parent | 7f269a5db8b88fbb14ee741f78e726b1a46c7d4d (diff) |
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>
Diffstat (limited to 'src/plugins/platforms/cocoa/qnswindow.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qnswindow.mm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm index 96c0314769..f76934033c 100644 --- a/src/plugins/platforms/cocoa/qnswindow.mm +++ b/src/plugins/platforms/cocoa/qnswindow.mm @@ -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) |