Fixes atom/atom#1841.
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),
- inspectable_web_contents_(
- brightray::InspectableWebContents::Create(web_contents)) {
+ weak_factory_(this) {
options->GetBoolean(switches::kFrame, &has_frame_);
#if defined(OS_MACOSX)
// Window icon.
gfx::Image icon_;
+ scoped_ptr<brightray::InspectableWebContents> inspectable_web_contents_;
+
private:
// Schedule a notification unresponsive event.
void ScheduleUnresponsiveEvent(int ms);
scoped_ptr<DevToolsWebContentsObserver> devtools_web_contents_observer_;
scoped_ptr<AtomJavaScriptDialogManager> dialog_manager_;
- scoped_ptr<brightray::InspectableWebContents> inspectable_web_contents_;
// Maps url to file path, used by the file requests sent from devtools.
typedef std::map<std::string, base::FilePath> PathsMap;
}
- (void)windowWillClose:(NSNotification*)notification {
- shell_->window() = nil;
[self autorelease];
}
[[AtomNSWindowDelegate alloc] initWithShell:this];
[window() setDelegate:delegate];
+ // We will manage window's lifetime ourselves.
+ [window() setReleasedWhenClosed:NO];
+
// Enable the NSView to accept first mouse event.
bool acceptsFirstMouse = false;
options->GetBoolean(switches::kAcceptFirstMouse, &acceptsFirstMouse);
}
NativeWindowMac::~NativeWindowMac() {
+ // Force InspectableWebContents to be destroyed before we destroy window,
+ // because it may still be observing the window at this time.
+ inspectable_web_contents_.reset();
+
if (window())
- // Use autorelease since we may have delegates or observers at this time.
- [window() autorelease];
+ [window_ release];
}
void NativeWindowMac::Close() {