Fix a possible crash when destroying window.

It could happend that the JS BrowserWindow object being double deleted
when calling the destroy() method.
This commit is contained in:
Cheng Zhao 2014-03-26 09:14:05 +08:00
parent 9ab3b5293c
commit 8b41e78245

View file

@ -127,7 +127,9 @@ void Window::Destroy(const v8::FunctionCallbackInfo<v8::Value>& args) {
UNWRAP_WINDOW_AND_CHECK; UNWRAP_WINDOW_AND_CHECK;
base::ProcessHandle handle = self->window_->GetRenderProcessHandle(); base::ProcessHandle handle = self->window_->GetRenderProcessHandle();
base::MessageLoop::current()->DeleteSoon(FROM_HERE, self); // Just destroy the NativeWindow object, the api::Window object would be
// deleted in the coming OnWindowClosed event.
self->window_.reset();
// Make sure the renderer process is terminated, it could happen that the // Make sure the renderer process is terminated, it could happen that the
// renderer process became a zombie. // renderer process became a zombie.