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() { void Window::OnWindowClosed() {
Emit("closed");
if (api_web_contents_) { if (api_web_contents_) {
api_web_contents_->DestroyWebContents(); api_web_contents_->DestroyWebContents();
api_web_contents_ = nullptr; api_web_contents_ = nullptr;
@ -78,6 +76,8 @@ void Window::OnWindowClosed() {
RemoveFromWeakMap(); RemoveFromWeakMap();
window_->RemoveObserver(this); window_->RemoveObserver(this);
Emit("closed");
} }
void Window::OnWindowBlur() { void Window::OnWindowBlur() {

View file

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