]> khamidou — GitHub mirrors - electron.git/commitdiff
BrowserWindow.destroy() should not delete window immediately.
authorCheng Zhao <zcbenz@gmail.com>
Tue, 25 Mar 2014 08:58:34 +0000 (16:58 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 25 Mar 2014 09:00:03 +0000 (17:00 +0800)
It could cause crash when context menu is showing.

atom/browser/api/atom_api_window.cc

index e8a845ff6abf9aaa8c07099d2adb5be726ecd0cf..d9bd698d93a3833687efca9b07717c48995bde80 100644 (file)
@@ -127,7 +127,7 @@ void Window::Destroy(const v8::FunctionCallbackInfo<v8::Value>& args) {
   UNWRAP_WINDOW_AND_CHECK;
 
   base::ProcessHandle handle = self->window_->GetRenderProcessHandle();
-  delete self;
+  base::MessageLoop::current()->DeleteSoon(FROM_HERE, self);
 
   // Make sure the renderer process is terminated, it could happen that the
   // renderer process became a zombie.