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

Unified Diff: chrome/browser/ui/gtk/infobars/after_translate_infobar_gtk.cc

Issue 7981045: Make infobars ignore button clicks when closing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 3 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/infobars/after_translate_infobar_gtk.cc
===================================================================
--- chrome/browser/ui/gtk/infobars/after_translate_infobar_gtk.cc (revision 102206)
+++ chrome/browser/ui/gtk/infobars/after_translate_infobar_gtk.cc (working copy)
@@ -62,7 +62,7 @@
GtkWidget* button = gtk_button_new_with_label(
l10n_util::GetStringUTF8(IDS_TRANSLATE_INFOBAR_REVERT).c_str());
- g_signal_connect(button, "clicked",G_CALLBACK(&OnRevertPressedThunk), this);
+ g_signal_connect(button, "clicked", G_CALLBACK(&OnRevertPressedThunk), this);
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
}
@@ -71,6 +71,8 @@
}
void AfterTranslateInfoBar::OnOriginalLanguageModified(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;
@@ -83,6 +85,8 @@
}
void AfterTranslateInfoBar::OnTargetLanguageModified(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()->target_language_index())
return;
@@ -93,13 +97,19 @@
}
void AfterTranslateInfoBar::OnRevertPressed(GtkWidget* sender) {
+ if (!owned())
+ return; // We're closing; don't call anything, it might access the owner.
GetDelegate()->RevertTranslation();
}
void AfterTranslateInfoBar::SetOriginalLanguage(size_t language_index) {
+ if (!owned())
+ return; // We're closing; don't call anything, it might access the owner.
GetDelegate()->SetOriginalLanguage(language_index);
}
void AfterTranslateInfoBar::SetTargetLanguage(size_t language_index) {
+ if (!owned())
+ return; // We're closing; don't call anything, it might access the owner.
GetDelegate()->SetTargetLanguage(language_index);
}

Powered by Google App Engine
This is Rietveld 408576698