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:
deepak1556 2018-07-22 23:12:57 +05:30 committed by Aleksei Kuzmin
parent 9264a00dfd
commit 63006aebe8

View file

@ -60,7 +60,10 @@ NativeWindow::NativeWindow(const mate::Dictionary& options,
NativeWindow::~NativeWindow() {
// 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();
}