Remove window from observers when it's closed instead of deleted.
This commit is contained in:
parent
bccbc5e821
commit
db39910455
1 changed files with 7 additions and 5 deletions
|
@ -75,8 +75,6 @@ Window::Window(base::DictionaryValue* options)
|
||||||
|
|
||||||
Window::~Window() {
|
Window::~Window() {
|
||||||
Emit("destroyed");
|
Emit("destroyed");
|
||||||
|
|
||||||
window_->RemoveObserver(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::OnPageTitleUpdated(bool* prevent_default,
|
void Window::OnPageTitleUpdated(bool* prevent_default,
|
||||||
|
@ -99,9 +97,13 @@ void Window::WillCloseWindow(bool* prevent_default) {
|
||||||
void Window::OnWindowClosed() {
|
void Window::OnWindowClosed() {
|
||||||
Emit("closed");
|
Emit("closed");
|
||||||
|
|
||||||
// Free memory when native window is closed, the delete is delayed so other
|
if (window_) {
|
||||||
// observers would not get a invalid pointer of NativeWindow.
|
window_->RemoveObserver(this);
|
||||||
base::MessageLoop::current()->DeleteSoon(FROM_HERE, window_.release());
|
|
||||||
|
// Free memory when native window is closed, the delete is delayed so other
|
||||||
|
// observers would not get a invalid pointer of NativeWindow.
|
||||||
|
base::MessageLoop::current()->DeleteSoon(FROM_HERE, window_.release());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::OnWindowBlur() {
|
void Window::OnWindowBlur() {
|
||||||
|
|
Loading…
Reference in a new issue