Remove window from window list before notifying closed event

This commit is contained in:
Cheng Zhao
2015-06-27 17:01:20 +08:00
parent 4b4654ec71
commit 1e514620b5
2 changed files with 4 additions and 4 deletions

View File

@@ -68,8 +68,6 @@ void Window::WillCloseWindow(bool* prevent_default) {
}
void Window::OnWindowClosed() {
Emit("closed");
if (api_web_contents_) {
api_web_contents_->DestroyWebContents();
api_web_contents_ = nullptr;
@@ -78,6 +76,8 @@ void Window::OnWindowClosed() {
RemoveFromWeakMap();
window_->RemoveObserver(this);
Emit("closed");
}
void Window::OnWindowBlur() {

View File

@@ -443,10 +443,10 @@ void NativeWindow::NotifyWindowClosed() {
if (is_closed_)
return;
WindowList::RemoveWindow(this);
is_closed_ = true;
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowClosed());
WindowList::RemoveWindow(this);
}
void NativeWindow::NotifyWindowBlur() {