Bug 599 - toolbar leaks memory on changing property list
Summary: toolbar leaks memory on changing property list
Status: RESOLVED FIXED
Alias: None
Product: UIM
Classification: Unclassified
Component: helper: toolbar (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: uim-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-05 19:07 UTC by Yusuke TABATA
Modified: 2004-05-07 05:41 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Yusuke TABATA 2004-05-05 19:07:34 UTC
Memory consumption of toolbar increases some kilobytes everytime we change the
focus between applications.
Comment 1 Yusuke TABATA 2004-05-05 20:21:11 UTC
Following diff diminishes most of leak. However, there still some leaks remains.

--- helper-toolbar-common-gtk.c (revision 792)
+++ helper-toolbar-common-gtk.c (working copy)
@@ -88,7 +88,7 @@
 static void
 helper_applet_prop_list_update(gchar **tmp)
 {
-  GtkMenuShell *prop_menu = NULL; /* quiet gcc */
+  static GtkMenuShell *prop_menu = NULL; /* quiet gcc */
   GtkWidget *button;
   int i = 0;
   gchar **tmp2 = NULL;
@@ -137,6 +137,10 @@
          button = gtk_button_new_with_label(tmp2[1]);
          gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0);
          menu_buttons = g_list_append(menu_buttons, button);
+
+         if (prop_menu) {
+           gtk_widget_destroy(prop_menu);
+         }
           
          prop_menu = (GtkMenuShell*)gtk_menu_new();
Comment 2 Yusuke TABATA 2004-05-06 02:28:36 UTC
Here's another leak
--
          GtkWidget *menu_item = gtk_menu_item_new_with_label(tmp2[2]);
-         g_object_set_data(G_OBJECT(menu_item), "prop_name", g_strdup(tmp2[4]));
+         g_object_set_data_full(G_OBJECT(menu_item), "prop_name",
g_strdup(tmp2[4]), g_free);
          gtk_menu_shell_append(prop_menu, menu_item);
Comment 3 Yusuke TABATA 2004-05-07 04:10:35 UTC
Diff in comment #2 is obvious. So I commited it.
Please audit #1 and investigate other leaks. menu_item is possible culprit.
Comment 4 TOKUNAGA Hiroyuki 2004-05-08 04:38:33 UTC
First patch is not enough to fix all of memory leaks, because prop_menu
may be used more than one times.

I committed fix of leaking by another way, please test rev 814.
Comment 5 Yusuke TABATA 2004-05-08 15:41:21 UTC
I confirmed.
This problem seems to have fixed.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.