Mercurial > pidgin.yaz
changeset 26175:1830d339f9b9
Properly free item factory. Should fix a crash on close.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Sat, 21 Feb 2009 05:15:14 +0000 |
parents | cc96a5ec4782 |
children | cb3c6ec9291e |
files | pidgin/gtkmedia.c |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkmedia.c Thu Feb 05 08:22:27 2009 +0000 +++ b/pidgin/gtkmedia.c Sat Feb 21 05:15:14 2009 +0000 @@ -58,6 +58,7 @@ GstElement *send_level; GstElement *recv_level; + GtkItemFactory *item_factory; GtkWidget *menubar; GtkWidget *statusbar; @@ -245,7 +246,6 @@ static GtkWidget * setup_menubar(PidginMedia *window) { - GtkItemFactory *item_factory; GtkAccelGroup *accel_group; GtkWidget *menu; @@ -253,19 +253,20 @@ 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 @@ 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;