Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Unified Diff: chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm

Issue 12572006: Fix crash in extension_popup_controller.mm appearing when devtools is closed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add reset back Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
diff --git a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
index 74a23a1c95446279079e6053926b7976526ee8d5..d34404af4da570545af4d858479a021a5b58d1b5 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
@@ -81,7 +81,8 @@ class ExtensionPopupContainer : public ExtensionViewMac::Container {
class DevtoolsNotificationBridge : public content::NotificationObserver {
public:
explicit DevtoolsNotificationBridge(ExtensionPopupController* controller)
- : controller_(controller) {}
+ : controller_(controller),
+ render_view_host_([controller_ extensionHost]->render_view_host()) {}
virtual void Observe(
int type,
@@ -96,16 +97,14 @@ class DevtoolsNotificationBridge : public content::NotificationObserver {
break;
}
case content::NOTIFICATION_DEVTOOLS_AGENT_ATTACHED: {
- RenderViewHost* rvh = [controller_ extensionHost]->render_view_host();
- if (content::Details<RenderViewHost>(rvh) == details)
+ if (content::Details<RenderViewHost>(render_view_host_) == details)
// Set the flag on the controller so the popup is not hidden when
// the dev tools get focus.
[controller_ setBeingInspected:YES];
break;
}
case content::NOTIFICATION_DEVTOOLS_AGENT_DETACHED: {
- RenderViewHost* rvh = [controller_ extensionHost]->render_view_host();
- if (content::Details<RenderViewHost>(rvh) == details)
+ if (content::Details<RenderViewHost>(render_view_host_) == details)
// Allow the devtools to finish detaching before we close the popup
[controller_ performSelector:@selector(close)
withObject:nil
@@ -121,6 +120,9 @@ class DevtoolsNotificationBridge : public content::NotificationObserver {
private:
ExtensionPopupController* controller_;
+ // RenderViewHost for controller. Hold onto this separately because we need to
+ // know what it is for notifications, but our ExtensionHost may not be valid.
+ RenderViewHost* render_view_host_;
};
@implementation ExtensionPopupController
@@ -199,10 +201,9 @@ class DevtoolsNotificationBridge : public content::NotificationObserver {
- (void)windowWillClose:(NSNotification *)notification {
[super windowWillClose:notification];
gPopup = nil;
- if (host_->view()) {
+ if (host_->view())
host_->view()->set_container(NULL);
- host_.reset();
- }
+ host_.reset();
}
- (void)windowDidResignKey:(NSNotification*)notification {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698