Free the native window's memory after the event were sent for all observers.
If we delete the window immediately other observers may get a invalid window and cause random crashes.
This commit is contained in:
parent
10a46b4229
commit
54b0d0c9c0
1 changed files with 3 additions and 2 deletions
|
@ -61,8 +61,9 @@ void Window::WillCloseWindow(bool* prevent_default) {
|
|||
void Window::OnWindowClosed() {
|
||||
Emit("closed");
|
||||
|
||||
// Free memory immediately when window is closed.
|
||||
delete 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, this);
|
||||
}
|
||||
|
||||
void Window::OnWindowBlur() {
|
||||
|
|
Loading…
Reference in a new issue