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:
parent
fb67ac6368
commit
f0dd6655e1
@ -372,6 +372,7 @@ QT_END_NAMESPACE
|
|||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[[NSStatusBar systemStatusBar] removeStatusItem:item];
|
[[NSStatusBar systemStatusBar] removeStatusItem:item];
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:imageCell];
|
[[NSNotificationCenter defaultCenter] removeObserver:imageCell];
|
||||||
|
imageCell.parent = nil;
|
||||||
[imageCell release];
|
[imageCell release];
|
||||||
[item release];
|
[item release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
|
Loading…
Reference in New Issue
Block a user