[gnumeric] GUI: Plug leaks.



commit 06af9624c2ca2d6281b59656455e33ae470a167a
Author: Morten Welinder <terra gnome org>
Date:   Tue Mar 18 20:19:48 2014 -0400

    GUI: Plug leaks.

 ChangeLog       |    7 +++++++
 NEWS            |    3 +++
 src/gui-util.c  |   12 +++++++-----
 src/item-grid.c |   14 ++++++++++----
 4 files changed, 27 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 850b208..5d2c687 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-03-18  Morten Welinder  <terra gnome org>
+
+       * src/gui-util.c (kill_popup_menu): One more try at really killing
+       the context menu after we're done with it.
+
+       * src/item-grid.c (item_grid_realize): Plug leak.
+
 2014-03-18  Morten Welinder <terra gnome org>
 
        * configure.ac: Post-release bump.
diff --git a/NEWS b/NEWS
index 4e4093f..f6296a9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 Gnumeric 1.12.14
 
+Morten:
+       * Plug leaks.
+
 --------------------------------------------------------------------------
 Gnumeric 1.12.13
 
diff --git a/src/gui-util.c b/src/gui-util.c
index ab34f96..ebbcd21 100644
--- a/src/gui-util.c
+++ b/src/gui-util.c
@@ -446,16 +446,17 @@ gnm_gui_group_value (gpointer gui, char const * const group[])
 static gboolean
 cb_delayed_destroy (gpointer w)
 {
+       gtk_widget_destroy (gtk_widget_get_toplevel (w));
        gtk_widget_destroy (w);
+       g_object_unref (w);
        return FALSE;
 }
 
 static void
-kill_popup_menu (GtkWidget *widget, G_GNUC_UNUSED GtkMenu *menu)
+kill_popup_menu (GtkWidget *widget, G_GNUC_UNUSED gpointer user)
 {
        /* gtk+ currently gets unhappy if we destroy here, see bug 725142 */
-       g_idle_add (cb_delayed_destroy,
-                   gtk_widget_get_toplevel (widget));
+       g_idle_add (cb_delayed_destroy, widget);
 }
 
 /**
@@ -475,9 +476,10 @@ gnumeric_popup_menu (GtkMenu *menu, GdkEvent *event)
        if (event)
                gtk_menu_set_screen (menu, gdk_event_get_screen (event));
 
+       g_object_ref_sink (menu);
        g_signal_connect (G_OBJECT (menu),
-               "hide",
-               G_CALLBACK (kill_popup_menu), menu);
+                         "hide",
+                         G_CALLBACK (kill_popup_menu), NULL);
 
        /* Do NOT pass the button used to create the menu.
         * instead pass 0.  Otherwise bringing up a menu with
diff --git a/src/item-grid.c b/src/item-grid.c
index c3642bf..8ee1efc 100644
--- a/src/item-grid.c
+++ b/src/item-grid.c
@@ -198,7 +198,8 @@ static void
 item_grid_realize (GocItem *item)
 {
        GdkDisplay *display;
-       GnmItemGrid   *ig;
+       GnmItemGrid *ig;
+       GdkPixbuf *cursor_cross_pixbuf;
 
        parent_class->realize (item);
 
@@ -207,9 +208,14 @@ item_grid_realize (GocItem *item)
 
        display = gtk_widget_get_display (GTK_WIDGET (item->canvas));
        ig->cursor_link  = gdk_cursor_new_for_display (display, GDK_HAND2);
-       ig->cursor_cross = gdk_cursor_new_from_pixbuf (display,
-                       gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), "cursor_cross", 32, 0, NULL),
-                       17, 17);
+       cursor_cross_pixbuf =
+               gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+                                         "cursor_cross", 32, 0, NULL);
+       ig->cursor_cross =
+               gdk_cursor_new_from_pixbuf (display,
+                                           cursor_cross_pixbuf,
+                                           17, 17);
+       g_object_unref (cursor_cross_pixbuf);
        cb_cursor_motion (ig);
 }
 


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