Try to fix some gwarnings when pidgin_blist_update_sort_method gets called before the menu of the buddy list exists. This is pretty crappy, but this just helps me get through gdb faster right now.

Mon, 07 Sep 2020 05:57:50 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 07 Sep 2020 05:57:50 -0500
changeset 40529
5fca0fffc9c3
parent 40528
d9232e74f472
child 40530
ac5c0a85971e

Try to fix some gwarnings when pidgin_blist_update_sort_method gets called before the menu of the buddy list exists. This is pretty crappy, but this just helps me get through gdb faster right now.

There are some conditions where pidgin_blist_update_sort_methods will get called before the menu widget exists.

Testing Done:
Compiled and ran in gdb with `G_DEBUG=fatal-warnings`.

Reviewed at https://reviews.imfreedom.org/r/101/

pidgin/gtkblist.c file | annotate | diff | comparison | revisions
--- a/pidgin/gtkblist.c	Sat Sep 05 22:20:14 2020 -0500
+++ b/pidgin/gtkblist.c	Mon Sep 07 05:57:50 2020 -0500
@@ -7268,7 +7268,6 @@
 void
 pidgin_blist_update_sort_methods(void)
 {
-	GtkWidget *sort_item = NULL;
 	GMenu *menu = NULL;
 	GList *l;
 
@@ -7295,8 +7294,12 @@
 	}
 
 	/* replace the old submenu with a new one */
-	sort_item = pidgin_buddy_list_menu_get_sort_item(PIDGIN_BUDDY_LIST_MENU(gtkblist->menu));
-	gtk_menu_item_set_submenu(GTK_MENU_ITEM(sort_item),
-	                          gtk_menu_new_from_model(G_MENU_MODEL(menu)));
-	g_object_unref(G_OBJECT(menu));
-}
+	if(PIDGIN_IS_BUDDY_LIST_MENU(gtkblist->menu)) {
+		GtkWidget *item = NULL;
+
+		item = pidgin_buddy_list_menu_get_sort_item(PIDGIN_BUDDY_LIST_MENU(gtkblist->menu));
+		gtk_menu_item_set_submenu(GTK_MENU_ITEM(item),
+		                          gtk_menu_new_from_model(G_MENU_MODEL(menu)));
+		g_object_unref(G_OBJECT(menu));
+	}
+}

mercurial