| 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
|
|
|