QNSColorPanelDelegate: Don't restore stolen view on dealloc

We may not be playing nice with Cocoa's internals when
we decide to reparent NSColorPanel's contents to add
QColorDialog's own OK/Cancel buttons. In order to reduce
issues, we should avoid poking at things during the
application's shutdown sequence. Simply releasing the
stolen view should be enough at that point.

A similar pattern exists in QNSFontPanelDelegate.

Change-Id: I678c236e0c57c4d08a1109a479d965f924288c54
Task-number: QTBUG-56448
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
This commit is contained in:
Gabriel de Dietrich 2016-10-24 13:49:41 -07:00 committed by Morten Johan Sørvig
parent af3e697ad6
commit f9280ba45e
2 changed files with 2 additions and 2 deletions

View File

@ -116,7 +116,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate);
- (void)dealloc
{
[self restoreOriginalContentView];
[mStolenContentView release];
[mColorPanel setDelegate:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self];

View File

@ -144,7 +144,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate);
- (void)dealloc
{
[self restoreOriginalContentView];
[mStolenContentView release];
[mFontPanel setDelegate:nil];
[[NSFontManager sharedFontManager] setDelegate:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self];