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

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: 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..fd891d0c04a5e55e95e6932203066773beceabbc 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),
+ rvh_([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>(rvh_) == 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>(rvh_) == 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 when our ExtensionHost may no longer be valid.
+ RenderViewHost* rvh_;
Matt Perry 2013/03/15 22:55:46 nit: don't abbrev member vars
not at google - send to devlin 2013/03/15 23:49:53 Done.
};
@implementation ExtensionPopupController
@@ -199,10 +201,8 @@ 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();
- }
}
- (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