REVIEW: Delete WidgetDelegate before widget is destroyed.
Ideally widget delegates must outlive their widget, but since we manage the lifetime of native widget, allow the delegate to be destroyed when widget is destroyed. https://chromium-review.googlesource.com/c/chromium/src/+/977244
This commit is contained in:
parent
9264a00dfd
commit
63006aebe8
1 changed files with 4 additions and 1 deletions
|
@ -60,7 +60,10 @@ NativeWindow::NativeWindow(const mate::Dictionary& options,
|
||||||
|
|
||||||
NativeWindow::~NativeWindow() {
|
NativeWindow::~NativeWindow() {
|
||||||
// It's possible that the windows gets destroyed before it's closed, in that
|
// It's possible that the windows gets destroyed before it's closed, in that
|
||||||
// case we need to ensure the OnWindowClosed message is still notified.
|
// case we need to ensure the Widget delegate gets destroyed and
|
||||||
|
// OnWindowClosed message is still notified.
|
||||||
|
if (widget_->widget_delegate())
|
||||||
|
widget_->OnNativeWidgetDestroyed();
|
||||||
NotifyWindowClosed();
|
NotifyWindowClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue