From 41f9f0a717f8519cf8c69cb043198980fe503ebc Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 10 Feb 2010 18:51:53 +0100 Subject: Fix leaked GtkMenu GtkMenu is initially unowned, which means ref_count is 1 and floating flag is set. gtk_menu_popup temporarily adds a ref, that will be dropped when the menu is popped down. So once the menu is popped up, we call g_object_ref_sink() to clear the floating flag, and g_object_unref() to drop the initial ref. Only the ref from gtk_menu_popup stay, and the menu will be finalized when it is popped down. Fixes bug #609567 --- src/empathy-debug-window.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/empathy-debug-window.c') diff --git a/src/empathy-debug-window.c b/src/empathy-debug-window.c index e411fcd73..da2c0e079 100644 --- a/src/empathy-debug-window.c +++ b/src/empathy-debug-window.c @@ -889,6 +889,8 @@ debug_window_show_menu (gpointer user_data) gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, data->button, data->time); + g_object_ref_sink (menu); + g_object_unref (menu); g_slice_free (MenuPopupData, user_data); -- cgit v1.2.3