summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-13 21:47:51 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-13 21:47:51 +0000
commit04e836c32bb107053ed5889ab8a297e3bec49b28 (patch)
tree2f50621c5602e198ad4c0cd173e1770ff83494a6 /chrome
parentfb6d030da5368b3c1e9e20c82a25a2540cd335b4 (diff)
downloadchromium_src-04e836c32bb107053ed5889ab8a297e3bec49b28.zip
chromium_src-04e836c32bb107053ed5889ab8a297e3bec49b28.tar.gz
chromium_src-04e836c32bb107053ed5889ab8a297e3bec49b28.tar.bz2
GTK: own a widget that was being accessed after destruction.
BUG=48908 TEST=see bug Review URL: http://codereview.chromium.org/2996002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52224 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/gtk/browser_toolbar_gtk.cc13
-rw-r--r--chrome/browser/gtk/browser_toolbar_gtk.h2
2 files changed, 8 insertions, 7 deletions
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc
index e746d6f..b88bcc2 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_toolbar_gtk.cc
@@ -126,6 +126,7 @@ BrowserToolbarGtk::~BrowserToolbarGtk() {
app_menu_.reset();
page_menu_button_.Destroy();
app_menu_button_.Destroy();
+ app_menu_image_.Destroy();
}
void BrowserToolbarGtk::Init(Profile* profile,
@@ -225,10 +226,10 @@ void BrowserToolbarGtk::Init(Profile* profile,
WideToUTF16(l10n_util::GetString(IDS_PRODUCT_NAME))),
&app_menu_button_);
menu_bar_helper_.Add(app_menu_button_.get());
- app_menu_image_ = gtk_image_new_from_pixbuf(
- theme_provider_->GetRTLEnabledPixbufNamed(IDR_MENU_CHROME));
- gtk_container_add(GTK_CONTAINER(chrome_menu), app_menu_image_);
- g_signal_connect_after(app_menu_image_, "expose-event",
+ app_menu_image_.Own(gtk_image_new_from_pixbuf(
+ theme_provider_->GetRTLEnabledPixbufNamed(IDR_MENU_CHROME)));
+ gtk_container_add(GTK_CONTAINER(chrome_menu), app_menu_image_.get());
+ g_signal_connect_after(app_menu_image_.get(), "expose-event",
G_CALLBACK(OnAppMenuImageExposeThunk), this);
if (use_wrench_menu)
@@ -425,7 +426,7 @@ void BrowserToolbarGtk::Observe(NotificationType type,
gtk_image_set_from_pixbuf(GTK_IMAGE(page_menu_image_),
theme_provider_->GetRTLEnabledPixbufNamed(IDR_MENU_PAGE));
}
- gtk_image_set_from_pixbuf(GTK_IMAGE(app_menu_image_),
+ gtk_image_set_from_pixbuf(GTK_IMAGE(app_menu_image_.get()),
theme_provider_->GetRTLEnabledPixbufNamed(IDR_MENU_CHROME));
// Force the height of the toolbar so we get the right amount of padding
@@ -783,7 +784,7 @@ void BrowserToolbarGtk::AnimationEnded(const Animation* animation) {
void BrowserToolbarGtk::AnimationProgressed(const Animation* animation) {
DCHECK_EQ(animation, &upgrade_reminder_animation_);
- gtk_widget_queue_draw(app_menu_image_);
+ gtk_widget_queue_draw(app_menu_image_.get());
}
void BrowserToolbarGtk::AnimationCanceled(const Animation* animation) {
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.h b/chrome/browser/gtk/browser_toolbar_gtk.h
index 6a89f4c..a0619b2 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.h
+++ b/chrome/browser/gtk/browser_toolbar_gtk.h
@@ -230,7 +230,7 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver,
// Keep a pointer to the menu button images because we change them when
// the theme changes.
GtkWidget* page_menu_image_;
- GtkWidget* app_menu_image_;
+ OwnedWidgetGtk app_menu_image_;
// The model that contains the security level, text, icon to display...
ToolbarModel* model_;