diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-11-15 13:45:46 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-11-20 19:51:00 +0000 |
commit | 6c1656397a2d0c30810cdbd880eda9e9c43fbe67 (patch) | |
tree | bf423e4b0598e60489645986166328a46ea202d7 /src/plugins | |
parent | 574bf5d9aaea3319e6761b9782ab7ae99991771d (diff) |
macOS: Ensure NSWindow delegate is released in sync with its NSWindow
Releasing it in [QNSWindow closeAndRelease] is wrong, as we only call
that method from a few call sites, and can easily end up with a normal
dealloc by means of e.g. the [m_nsWindow release] in ~QCocoaWindow.
This still leaves Xcode thinking we have a single leaking delegate
per active NSWindow, as it apparently doesn't realize we're calling
release manually. This needs to be investigated further.
Task-number: QTBUG-65693
Change-Id: I9105602274d8532465e5108aba2b05bf253268e9
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qnswindow.mm | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm index 1b9dd95cbc..b3cd3c1d8c 100644 --- a/src/plugins/platforms/cocoa/qnswindow.mm +++ b/src/plugins/platforms/cocoa/qnswindow.mm @@ -239,10 +239,6 @@ static bool isMouseEvent(NSEvent *ev) - (void)closeAndRelease { qCDebug(lcQpaWindow) << "closeAndRelease" << self; - - [self.delegate release]; - self.delegate = nil; - [self close]; [self release]; } @@ -252,6 +248,9 @@ static bool isMouseEvent(NSEvent *ev) - (void)dealloc { qCDebug(lcQpaWindow) << "dealloc" << self; + [self.delegate release]; + self.delegate = nil; + qt_objcDynamicSuper(); } #pragma clang diagnostic pop |