Index: chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc |
=================================================================== |
--- chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc (revision 134516) |
+++ chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc (working copy) |
@@ -31,6 +31,7 @@ |
#include "ui/base/gtk/gtk_compat.h" |
#include "ui/base/gtk/gtk_hig_constants.h" |
#include "ui/base/gtk/gtk_screen_util.h" |
+#include "ui/base/gtk/gtk_signal_registrar.h" |
#include "ui/base/gtk/gtk_windowing.h" |
#include "ui/gfx/color_utils.h" |
#include "ui/gfx/font.h" |
@@ -276,7 +277,8 @@ |
OmniboxView* omnibox_view, |
AutocompleteEditModel* edit_model, |
GtkWidget* location_bar) |
- : model_(new AutocompletePopupModel(this, edit_model)), |
+ : signal_registrar_(new ui::GtkSignalRegistrar), |
+ model_(new AutocompletePopupModel(this, edit_model)), |
omnibox_view_(omnibox_view), |
location_bar_(location_bar), |
window_(gtk_window_new(GTK_WINDOW_POPUP)), |
@@ -306,14 +308,14 @@ |
GDK_POINTER_MOTION_MASK | |
GDK_BUTTON_PRESS_MASK | |
GDK_BUTTON_RELEASE_MASK); |
- g_signal_connect(window_, "motion-notify-event", |
- G_CALLBACK(HandleMotionThunk), this); |
- g_signal_connect(window_, "button-press-event", |
- G_CALLBACK(HandleButtonPressThunk), this); |
- g_signal_connect(window_, "button-release-event", |
- G_CALLBACK(HandleButtonReleaseThunk), this); |
- g_signal_connect(window_, "expose-event", |
- G_CALLBACK(HandleExposeThunk), this); |
+ signal_registrar_->Connect(window_, "motion-notify-event", |
+ G_CALLBACK(HandleMotionThunk), this); |
+ signal_registrar_->Connect(window_, "button-press-event", |
+ G_CALLBACK(HandleButtonPressThunk), this); |
+ signal_registrar_->Connect(window_, "button-release-event", |
+ G_CALLBACK(HandleButtonReleaseThunk), this); |
+ signal_registrar_->Connect(window_, "expose-event", |
+ G_CALLBACK(HandleExposeThunk), this); |
registrar_.Add(this, |
chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
@@ -334,6 +336,10 @@ |
} |
OmniboxPopupViewGtk::~OmniboxPopupViewGtk() { |
+ // Stop listening to our signals before we destroy the model. I suspect that |
+ // we can race window destruction, otherwise. |
+ signal_registrar_.reset(); |
+ |
// Explicitly destroy our model here, before we destroy our GTK widgets. |
// This is because the model destructor can call back into us, and we need |
// to make sure everything is still valid when it does. |