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

Unified Diff: chrome/browser/repost_form_warning_controller.cc

Issue 1530032: Ensure proper teardown of repost form warning objects. (Closed)
Patch Set: Remove unnecessary code from RepostFormWarningGtk. Created 10 years, 8 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 | « chrome/browser/repost_form_warning_controller.h ('k') | chrome/browser/views/repost_form_warning_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/repost_form_warning_controller.cc
diff --git a/chrome/browser/repost_form_warning_controller.cc b/chrome/browser/repost_form_warning_controller.cc
index 7b38c4cd1d5153603c8a53e460c5c0e74023e0b0..2cf6ff5befff0e466a5fa01b191827017c1a0f31 100644
--- a/chrome/browser/repost_form_warning_controller.cc
+++ b/chrome/browser/repost_form_warning_controller.cc
@@ -21,6 +21,11 @@ RepostFormWarningController::RepostFormWarningController(
}
RepostFormWarningController::~RepostFormWarningController() {
+ // If we end up here, the constrained window has been closed, so make sure we
+ // don't close it again.
+ window_ = NULL;
+ // Make sure everything is cleaned up.
+ Cancel();
}
void RepostFormWarningController::Show(
@@ -48,7 +53,8 @@ void RepostFormWarningController::Observe(NotificationType type,
// Close the dialog if we load a page (because reloading might not apply to
// the same page anymore) or if the tab is closed, because then we won't have
// a navigation controller anymore.
- if ((type == NotificationType::LOAD_START ||
+ if (tab_contents_ &&
+ (type == NotificationType::LOAD_START ||
type == NotificationType::TAB_CLOSING ||
type == NotificationType::REPOST_WARNING_SHOWN)) {
DCHECK_EQ(Source<NavigationController>(source).ptr(),
@@ -58,9 +64,9 @@ void RepostFormWarningController::Observe(NotificationType type,
}
void RepostFormWarningController::CloseDialog() {
+ // Make sure we won't do anything when |Cancel()| is called again.
tab_contents_ = NULL;
if (window_) {
window_->CloseConstrainedWindow();
}
- delete this;
}
« no previous file with comments | « chrome/browser/repost_form_warning_controller.h ('k') | chrome/browser/views/repost_form_warning_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698