summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-05-24 17:17:00 -0700
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-06-13 01:30:53 +0000
commitb91d37a600872298389e99fc354d76e9c37aa3bb (patch)
tree3e04fbcdf8a7443838dcf36bb4ffc9b91f1295f4 /src/plugins
parent57d16c12ccb8d50e208078c37d13fa752eab98e1 (diff)
QNSView: Remove tracking area on deallocation
Ultimately, the tracking areas seem to be managed by the NSWindow (or at least somewhere else than the NSView itself). So, it can happen that we involuntarily leave dangling pointers in the system after the QNSView is released. This has shown to crash applications creating and deleting many native views on a single QNSWindow, e.g. calling winId() on a complex and dynamic QWidget hierarchy. The crash would happen when the QNSWindow receives a native enter event, which results on Cocoa trying to invoke the owner of a previously deallocated NSTrackingArea. Change-Id: I3ca7a39ee5f1ec51c2215639f61ba907de3d8659 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 72e90a5363..66c3b6fad4 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -177,7 +177,10 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)dealloc
{
CGImageRelease(m_maskImage);
- [m_trackingArea release];
+ if (m_trackingArea) {
+ [self removeTrackingArea:m_trackingArea];
+ [m_trackingArea release];
+ }
m_maskImage = 0;
[m_inputSource release];
[[NSNotificationCenter defaultCenter] removeObserver:self];