Index: chrome/browser/ui/gtk/infobars/before_translate_infobar_gtk.cc |
=================================================================== |
--- chrome/browser/ui/gtk/infobars/before_translate_infobar_gtk.cc (revision 102206) |
+++ chrome/browser/ui/gtk/infobars/before_translate_infobar_gtk.cc (working copy) |
@@ -45,12 +45,12 @@ |
GtkWidget* button = gtk_button_new_with_label( |
l10n_util::GetStringUTF8(IDS_TRANSLATE_INFOBAR_ACCEPT).c_str()); |
- g_signal_connect(button, "clicked",G_CALLBACK(&OnAcceptPressedThunk), this); |
+ g_signal_connect(button, "clicked", G_CALLBACK(&OnAcceptPressedThunk), this); |
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
button = gtk_button_new_with_label( |
l10n_util::GetStringUTF8(IDS_TRANSLATE_INFOBAR_DENY).c_str()); |
- g_signal_connect(button, "clicked",G_CALLBACK(&OnDenyPressedThunk), this); |
+ g_signal_connect(button, "clicked", G_CALLBACK(&OnDenyPressedThunk), this); |
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
TranslateInfoBarDelegate* delegate = GetDelegate(); |
@@ -82,6 +82,8 @@ |
} |
void BeforeTranslateInfoBar::OnLanguageModified(GtkWidget* sender) { |
+ if (!owned()) |
+ return; // We're closing; don't call anything, it might access the owner. |
size_t index = GetLanguageComboboxActiveId(GTK_COMBO_BOX(sender)); |
if (index == GetDelegate()->original_language_index()) |
return; |
@@ -90,18 +92,26 @@ |
} |
void BeforeTranslateInfoBar::OnAcceptPressed(GtkWidget* sender) { |
+ if (!owned()) |
+ return; // We're closing; don't call anything, it might access the owner. |
GetDelegate()->Translate(); |
} |
void BeforeTranslateInfoBar::OnDenyPressed(GtkWidget* sender) { |
+ if (!owned()) |
+ return; // We're closing; don't call anything, it might access the owner. |
GetDelegate()->TranslationDeclined(); |
RemoveSelf(); |
} |
void BeforeTranslateInfoBar::OnNeverTranslatePressed(GtkWidget* sender) { |
+ if (!owned()) |
+ return; // We're closing; don't call anything, it might access the owner. |
GetDelegate()->NeverTranslatePageLanguage(); |
} |
void BeforeTranslateInfoBar::OnAlwaysTranslatePressed(GtkWidget* sender) { |
+ if (!owned()) |
+ return; // We're closing; don't call anything, it might access the owner. |
GetDelegate()->AlwaysTranslatePageLanguage(); |
} |