diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2010-02-11 01:51:53 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2010-02-11 03:14:20 +0800 |
commit | 41f9f0a717f8519cf8c69cb043198980fe503ebc (patch) | |
tree | 3cff33d8c48cc69a2778f27f56b15372416decba /libempathy-gtk/empathy-contact-widget.c | |
parent | ddbfc6ec6a3b2ffab1f83471dbf1f82630292f8a (diff) | |
download | gsoc2013-empathy-41f9f0a717f8519cf8c69cb043198980fe503ebc.tar gsoc2013-empathy-41f9f0a717f8519cf8c69cb043198980fe503ebc.tar.gz gsoc2013-empathy-41f9f0a717f8519cf8c69cb043198980fe503ebc.tar.bz2 gsoc2013-empathy-41f9f0a717f8519cf8c69cb043198980fe503ebc.tar.lz gsoc2013-empathy-41f9f0a717f8519cf8c69cb043198980fe503ebc.tar.xz gsoc2013-empathy-41f9f0a717f8519cf8c69cb043198980fe503ebc.tar.zst gsoc2013-empathy-41f9f0a717f8519cf8c69cb043198980fe503ebc.zip |
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
Diffstat (limited to 'libempathy-gtk/empathy-contact-widget.c')
-rw-r--r-- | libempathy-gtk/empathy-contact-widget.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c index 3e8ed8430..f55e81405 100644 --- a/libempathy-gtk/empathy-contact-widget.c +++ b/libempathy-gtk/empathy-contact-widget.c @@ -826,9 +826,10 @@ popup_avatar_menu (EmpathyContactWidget *information, event_time = gtk_get_current_event_time (); } - gtk_menu_attach_to_widget (GTK_MENU (menu), parent, NULL); gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, button, event_time); + g_object_ref_sink (menu); + g_object_unref (menu); } static gboolean |