pidgin.vv: 6034e4df: Properly free item factory. Should fix a...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Sat Feb 21 02:25:35 EST 2009


-----------------------------------------------------------------
Revision: 6034e4df300b7da5e8fc3095e128f6215af903ab
Ancestor: 8a5e7d720be0e54f922433c20634edb0ed1387e2
Author: maiku at soc.pidgin.im
Date: 2009-02-21T05:15:14
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/6034e4df300b7da5e8fc3095e128f6215af903ab

Modified files:
        pidgin/gtkmedia.c

ChangeLog: 

Properly free item factory. Should fix a crash on close.

-------------- next part --------------
============================================================
--- pidgin/gtkmedia.c	20e2dd157d7e3e7a43d7a2f48dd6e0f5e8cc7083
+++ pidgin/gtkmedia.c	925e8fb81ea65d4d1c29a66832c22969f95c7eb1
@@ -58,6 +58,7 @@ struct _PidginMediaPrivate
 	GstElement *send_level;
 	GstElement *recv_level;
 
+	GtkItemFactory *item_factory;
 	GtkWidget *menubar;
 	GtkWidget *statusbar;
 
@@ -245,7 +246,6 @@ setup_menubar(PidginMedia *window)
 static GtkWidget *
 setup_menubar(PidginMedia *window)
 {
-	GtkItemFactory *item_factory;
 	GtkAccelGroup *accel_group;
 	GtkWidget *menu;
 
@@ -253,19 +253,20 @@ setup_menubar(PidginMedia *window)
 	gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
 	g_object_unref(accel_group);
 
-	item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR,
+	window->priv->item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR,
 			"<main>", accel_group);
 
-	gtk_item_factory_set_translate_func(item_factory,
+	gtk_item_factory_set_translate_func(window->priv->item_factory,
 			(GtkTranslateFunc)item_factory_translate_func,
 			NULL, NULL);
 
-	gtk_item_factory_create_items(item_factory, menu_item_count,
-			menu_items, window);
+	gtk_item_factory_create_items(window->priv->item_factory,
+			menu_item_count, menu_items, window);
 	g_signal_connect(G_OBJECT(accel_group), "accel-changed",
 			G_CALLBACK(pidgin_save_accels_cb), NULL);
 
-	menu = gtk_item_factory_get_widget(item_factory, "<main>");
+	menu = gtk_item_factory_get_widget(
+			window->priv->item_factory, "<main>");
 
 	gtk_widget_show(menu);
 	return menu;
@@ -391,6 +392,11 @@ pidgin_media_dispose(GObject *media)
 		gtkmedia->priv->media = NULL;
 	}
 
+	if (gtkmedia->priv->item_factory) {
+		g_object_unref(gtkmedia->priv->item_factory);
+		gtkmedia->priv->item_factory = NULL;
+	}
+
 	if (gtkmedia->priv->send_level) {
 		gst_object_unref(gtkmedia->priv->send_level);
 		gtkmedia->priv->send_level = NULL;


More information about the Commits mailing list