Bug 1389908 - Make sure the NSColorPanel never has a dangling target, and make sure to set the new target before calling setColor. r=spohl

MozReview-Commit-ID: L71yb593eR2

--HG--
extra : rebase_source : e09fbf3a95ea445180d24c0ee81b153a57441b97
This commit is contained in:
Markus Stange 2017-08-21 19:16:22 -04:00
parent 667a3cb5a4
commit fa53d431d3

View File

@ -54,11 +54,11 @@ HexStrToInt(NSString* str)
- (void)open:(NSColor*)aInitialColor title:(NSString*)aTitle
{
[mColorPanel setTitle:aTitle];
[mColorPanel setColor:aInitialColor];
[mColorPanel setTarget:self];
[mColorPanel setAction:@selector(colorChanged:)];
[mColorPanel setDelegate:self];
[mColorPanel setTitle:aTitle];
[mColorPanel setColor:aInitialColor];
[mColorPanel makeKeyAndOrderFront:nil];
}
@ -80,11 +80,9 @@ HexStrToInt(NSString* str)
- (void)dealloc
{
if ([mColorPanel delegate] == self) {
[mColorPanel setTarget:nil];
[mColorPanel setAction:nil];
[mColorPanel setDelegate:nil];
}
[mColorPanel setTarget:nil];
[mColorPanel setAction:nil];
[mColorPanel setDelegate:nil];
mColorPanel = nil;
mColorPicker = nullptr;