зеркало из https://github.com/electron/electron.git
Remove window from observers when it's closed instead of deleted.
This commit is contained in:
Родитель
bccbc5e821
Коммит
db39910455
|
@ -75,8 +75,6 @@ Window::Window(base::DictionaryValue* options)
|
|||
|
||||
Window::~Window() {
|
||||
Emit("destroyed");
|
||||
|
||||
window_->RemoveObserver(this);
|
||||
}
|
||||
|
||||
void Window::OnPageTitleUpdated(bool* prevent_default,
|
||||
|
@ -99,9 +97,13 @@ void Window::WillCloseWindow(bool* prevent_default) {
|
|||
void Window::OnWindowClosed() {
|
||||
Emit("closed");
|
||||
|
||||
// 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());
|
||||
if (window_) {
|
||||
window_->RemoveObserver(this);
|
||||
|
||||
// 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() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче