summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2011-08-25 14:50:30 -0400
committerColin Walters <walters@verbum.org>2011-12-20 15:36:48 -0500
commit06307dd774da77a2d74f5529feee2ca120804e2f (patch)
tree5d76c99bb489ae6bbc145a9061aede8826bd5f98
parentb5577781d196521ebfc09c3ca1f443140018b2e1 (diff)
downloadgtk+-06307dd774da77a2d74f5529feee2ca120804e2f.tar.gz
GtkAction: Hold a reference to proxy widgets
Previously we expect that a proxy widget holds a reference to the action via gtk_activatable_do_set_related_action(). However, it is possible for the widget to still be in a floating state when it adds itself to the the action. This is a problem when gtk_action_get_proxies() gets called, because we return floating objects back to the user. And language bindings aren't going to be expecting that. Fix this by calling ref_sink() and unref(). https://bugzilla.gnome.org/show_bug.cgi?id=657367
-rw-r--r--gtk/gtkaction.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c
index ad69d4f163..c24ee7859f 100644
--- a/gtk/gtkaction.c
+++ b/gtk/gtkaction.c
@@ -716,6 +716,7 @@ static void
remove_proxy (GtkAction *action,
GtkWidget *proxy)
{
+ g_object_unref (proxy);
action->private_data->proxies = g_slist_remove (action->private_data->proxies, proxy);
}
@@ -725,6 +726,8 @@ connect_proxy (GtkAction *action,
{
action->private_data->proxies = g_slist_prepend (action->private_data->proxies, proxy);
+ g_object_ref_sink (proxy);
+
if (action->private_data->action_group)
_gtk_action_group_emit_connect_proxy (action->private_data->action_group, action, proxy);