Merge pull request #11272 from syntropy-ai/1-7-x
Removed tracking area for tray to prevent mouse leave race condition crash
This commit is contained in:
commit
143816bee1
1 changed files with 9 additions and 3 deletions
|
@ -33,6 +33,7 @@ const CGFloat kVerticalTitleMargin = 2;
|
|||
base::scoped_nsobject<NSString> title_;
|
||||
base::scoped_nsobject<NSMutableAttributedString> attributedTitle_;
|
||||
base::scoped_nsobject<NSStatusItem> statusItem_;
|
||||
base::scoped_nsobject<NSTrackingArea> trackingArea_;
|
||||
}
|
||||
|
||||
@end // @interface StatusItemView
|
||||
|
@ -61,12 +62,12 @@ const CGFloat kVerticalTitleMargin = 2;
|
|||
[self updateDimensions];
|
||||
|
||||
// Add NSTrackingArea for listening to mouseEnter, mouseExit, and mouseMove events
|
||||
auto trackingArea = [[[NSTrackingArea alloc]
|
||||
trackingArea_.reset([[NSTrackingArea alloc]
|
||||
initWithRect:[self bounds]
|
||||
options:NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveAlways
|
||||
owner:self
|
||||
userInfo:nil] autorelease];
|
||||
[self addTrackingArea:trackingArea];
|
||||
userInfo:nil]);
|
||||
[self addTrackingArea:trackingArea_];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -78,6 +79,11 @@ const CGFloat kVerticalTitleMargin = 2;
|
|||
}
|
||||
|
||||
- (void)removeItem {
|
||||
// Turn off tracking events to prevent crash
|
||||
if (trackingArea_) {
|
||||
[self removeTrackingArea:trackingArea_];
|
||||
trackingArea_.reset();
|
||||
}
|
||||
[[NSStatusBar systemStatusBar] removeStatusItem:statusItem_];
|
||||
statusItem_.reset();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue