Fix a crash when destroying window.

This commit is contained in:
Cheng Zhao 2014-04-11 18:43:01 +08:00
parent 84d458687a
commit 5c5cf3c66e
3 changed files with 16 additions and 6 deletions

View file

@ -57,12 +57,12 @@ NativeWindow::NativeWindow(content::WebContents* web_contents,
base::DictionaryValue* options)
: content::WebContentsObserver(web_contents),
has_frame_(true),
inspectable_web_contents_(
brightray::InspectableWebContents::Create(web_contents)),
is_closed_(false),
node_integration_("except-iframe"),
has_dialog_attached_(false),
weak_factory_(this) {
weak_factory_(this),
inspectable_web_contents_(
brightray::InspectableWebContents::Create(web_contents)) {
options->GetBoolean(switches::kFrame, &has_frame_);
#if defined(OS_MACOSX)
@ -365,6 +365,10 @@ void NativeWindow::NotifyWindowBlur() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowBlur());
}
void NativeWindow::DestroyWebContents() {
inspectable_web_contents_.reset();
}
// In atom-shell all reloads and navigations started by renderer process would
// be redirected to this method, so we can have precise control of how we
// would open the url (in our case, is to restart the renderer process). See