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

Unified Diff: chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc

Issue 6873082: Fix DELETE_EVENT handling in 3 places. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 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
Index: chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc
diff --git a/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc b/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc
index 9e461a5af3be91dc96ae1aa711077c7614194176..1237d52649b672532c2baebeb0528fae4c17fc8f 100644
--- a/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc
@@ -34,6 +34,8 @@ class HungRendererDialogGtk {
void EndForTabContents(TabContents* hung_contents);
private:
+ ~HungRendererDialogGtk();
+
// The GtkTreeView column ids.
enum {
COL_FAVICON,
@@ -65,6 +67,14 @@ HungRendererDialogGtk::HungRendererDialogGtk()
Init();
}
+HungRendererDialogGtk::~HungRendererDialogGtk() {
+ DCHECK(g_instance == this);
+ g_instance = NULL;
+
+ if (dialog_)
+ gtk_widget_destroy(GTK_WIDGET(dialog_));
+}
+
void HungRendererDialogGtk::Init() {
dialog_ = GTK_DIALOG(gtk_dialog_new_with_buttons(
l10n_util::GetStringUTF8(IDS_BROWSER_HANGMONITOR_RENDERER_TITLE).c_str(),
@@ -77,6 +87,9 @@ void HungRendererDialogGtk::Init() {
NULL));
gtk_dialog_set_default_response(dialog_, GTK_RESPONSE_OK);
g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this);
+ // NULL out |dialog_| when it's destroyed.
+ g_signal_connect(dialog_, "destroy",
+ G_CALLBACK(gtk_widget_destroyed), &dialog_);
// We have an hbox with the frozen icon on the left. On the right,
// we have a vbox with the unresponsive text on top and a table of
@@ -183,7 +196,6 @@ void HungRendererDialogGtk::EndForTabContents(TabContents* contents) {
// When the user clicks a button on the dialog or closes the dialog, this
// callback is called.
void HungRendererDialogGtk::OnResponse(GtkWidget* dialog, int response_id) {
- DCHECK(g_instance == this);
switch (response_id) {
case kKillPagesButtonResponse:
// Kill the process.
@@ -203,9 +215,7 @@ void HungRendererDialogGtk::OnResponse(GtkWidget* dialog, int response_id) {
NOTREACHED();
}
- gtk_widget_destroy(GTK_WIDGET(dialog_));
- delete g_instance;
- g_instance = NULL;
+ delete this;
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698