[epiphany] ephy-page-menu-action: do not query the action proxies during dispose



commit 49580a45a618c6992b19988714d80f6f909095be
Author: Xan Lopez <xan igalia com>
Date:   Tue Jan 17 19:57:50 2012 +0100

    ephy-page-menu-action: do not query the action proxies during dispose
    
    That was a bad idea. Just store the proxy used for the visibility hack
    in the private data too.

 src/ephy-page-menu-action.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/src/ephy-page-menu-action.c b/src/ephy-page-menu-action.c
index b42d13c..3faddd2 100644
--- a/src/ephy-page-menu-action.c
+++ b/src/ephy-page-menu-action.c
@@ -27,6 +27,7 @@ G_DEFINE_TYPE (EphyPageMenuAction, ephy_page_menu_action, EPHY_TYPE_WINDOW_ACTIO
 
 struct _EphyPageMenuActionPrivate {
   GtkWidget *menu;
+  GtkWidget *button;
 };
 
 static void
@@ -101,6 +102,7 @@ button_press_cb (GtkWidget *button, GdkEventButton *event, EphyPageMenuAction *a
                       G_CALLBACK (visible_cb), button);
 
     action->priv->menu = g_object_ref (menu);
+    action->priv->button = g_object_ref (button);
   }
 
   if (event) {
@@ -146,17 +148,11 @@ ephy_page_menu_action_dispose (GObject *object)
 {
   EphyPageMenuActionPrivate *priv = EPHY_PAGE_MENU_ACTION (object)->priv;
 
-  if (priv->menu) {
-    GtkWidget *button = NULL;
-    GSList *l = gtk_action_get_proxies (GTK_ACTION (object));
-
-    if (GTK_IS_BUTTON (l->data))
-      button = GTK_WIDGET (l->data);
-
-    g_signal_handlers_disconnect_by_func (priv->menu, G_CALLBACK (visible_cb), button);
-  }
+  if (priv->menu)
+    g_signal_handlers_disconnect_by_func (priv->menu, G_CALLBACK (visible_cb), priv->button);
 
   g_clear_object (&priv->menu);
+  g_clear_object (&priv->button);
 
   G_OBJECT_CLASS (ephy_page_menu_action_parent_class)->dispose (object);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]