Fix QSystemTrayIcon stale pointer access

The child imageCell is a NSView and may be retained by Cocoa,
which means it may outlive the parent QNSStatusItem.

Clear its parent pointer to avoid referencing a stale
pointer.

Task-number: QTBUG-47929
Change-Id: I6078070b8c9f512ecd034fee4e54b1d8282dabdf
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Morten Johan Sørvig 2018-12-12 14:59:48 +01:00
parent fb67ac6368
commit f0dd6655e1

View File

@ -372,6 +372,7 @@ QT_END_NAMESPACE
- (void)dealloc {
[[NSStatusBar systemStatusBar] removeStatusItem:item];
[[NSNotificationCenter defaultCenter] removeObserver:imageCell];
imageCell.parent = nil;
[imageCell release];
[item release];
[super dealloc];