fix: remove event monitor before destroying window
This commit is contained in:
parent
9ff7807be8
commit
d1f0d6c184
1 changed files with 9 additions and 1 deletions
|
@ -480,7 +480,8 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeWindowMac::~NativeWindowMac() {
|
NativeWindowMac::~NativeWindowMac() {
|
||||||
[NSEvent removeMonitor:wheel_event_monitor_];
|
if (wheel_event_monitor_)
|
||||||
|
[NSEvent removeMonitor:wheel_event_monitor_];
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::SetContentView(views::View* view) {
|
void NativeWindowMac::SetContentView(views::View* view) {
|
||||||
|
@ -517,6 +518,13 @@ void NativeWindowMac::Close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::CloseImmediately() {
|
void NativeWindowMac::CloseImmediately() {
|
||||||
|
// Remove event monitor before destroying window, otherwise the monitor may
|
||||||
|
// call its callback after window has been destroyed.
|
||||||
|
if (wheel_event_monitor_) {
|
||||||
|
[NSEvent removeMonitor:wheel_event_monitor_];
|
||||||
|
wheel_event_monitor_ = nil;
|
||||||
|
}
|
||||||
|
|
||||||
// Retain the child window before closing it. If the last reference to the
|
// Retain the child window before closing it. If the last reference to the
|
||||||
// NSWindow goes away inside -[NSWindow close], then bad stuff can happen.
|
// NSWindow goes away inside -[NSWindow close], then bad stuff can happen.
|
||||||
// See e.g. http://crbug.com/616701.
|
// See e.g. http://crbug.com/616701.
|
||||||
|
|
Loading…
Add table
Reference in a new issue