[gtk+] menubutton: clear arrow_widget on remove()
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] menubutton: clear arrow_widget on remove()
- Date: Tue, 4 Sep 2012 14:05:15 +0000 (UTC)
commit 143a600466643e2c6fe3a00fb3849893de1e3641
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Sep 4 09:38:28 2012 -0400
menubutton: clear arrow_widget on remove()
So that we clear its pointer also in case somebody else calls
gtk_container_remove() on the button.
Fixes criticals at startup in e.g. Nautilus.
gtk/gtkmenubutton.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
index 048ab85..b5f7547 100644
--- a/gtk/gtkmenubutton.c
+++ b/gtk/gtkmenubutton.c
@@ -445,15 +445,24 @@ gtk_menu_button_add (GtkContainer *container,
GtkMenuButton *button = GTK_MENU_BUTTON (container);
if (button->priv->arrow_widget)
- {
- gtk_container_remove (container, button->priv->arrow_widget);
- button->priv->arrow_widget = NULL;
- }
+ gtk_container_remove (container, button->priv->arrow_widget);
GTK_CONTAINER_CLASS (gtk_menu_button_parent_class)->add (container, child);
}
static void
+gtk_menu_button_remove (GtkContainer *container,
+ GtkWidget *child)
+{
+ GtkMenuButton *button = GTK_MENU_BUTTON (container);
+
+ if (child == button->priv->arrow_widget)
+ button->priv->arrow_widget = NULL;
+
+ GTK_CONTAINER_CLASS (gtk_menu_button_parent_class)->remove (container, child);
+}
+
+static void
gtk_menu_button_class_init (GtkMenuButtonClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
@@ -471,6 +480,7 @@ gtk_menu_button_class_init (GtkMenuButtonClass *klass)
widget_class->button_press_event = gtk_menu_button_button_press_event;
container_class->add = gtk_menu_button_add;
+ container_class->remove = gtk_menu_button_remove;
toggle_button_class->toggled = gtk_menu_button_toggled;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]