diff options
author | Matthias Clasen <mclasen@redhat.com> | 2012-05-15 21:49:24 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2012-05-15 21:54:20 -0400 |
commit | 04b92a799ebbebc534a72b85a76a39089d77f3d3 (patch) | |
tree | f8d1069877c2fd2320f75d7fc7b7871bf3826010 /gtk/gtkuimanager.c | |
parent | b7cf588f6e4e5c3d25f941a649c9b6576fe35dbc (diff) | |
download | gtk+-04b92a799ebbebc534a72b85a76a39089d77f3d3.tar.gz |
Be more careful when freeing ui manager nodes
https://bugzilla.redhat.com//show_bug.cgi?id=812035 has
a stacktrace that shows recursion via
free_node -> unref -> dispose -> ui manager api
which ends in a crash, since we run free_node over the entire
tree and it leaves lots of dangling pointers behind.
So, better be careful by setting all pointers to NULL after
freeing them.
Diffstat (limited to 'gtk/gtkuimanager.c')
-rw-r--r-- | gtk/gtkuimanager.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/gtk/gtkuimanager.c b/gtk/gtkuimanager.c index bb0137f8b8..c80df7cd3a 100644 --- a/gtk/gtkuimanager.c +++ b/gtk/gtkuimanager.c @@ -1396,17 +1396,16 @@ static gboolean free_node (GNode *node) { Node *info = NODE_INFO (node); - + g_list_free_full (info->uifiles, node_ui_reference_free); + info->uifiles = NULL; - if (info->action) - g_object_unref (info->action); - if (info->proxy) - g_object_unref (info->proxy); - if (info->extra) - g_object_unref (info->extra); - g_free (info->name); + g_clear_object (&info->action); + g_clear_object (&info->proxy); + g_clear_object (&info->extra); + g_clear_pointer (&info->name, g_free); g_slice_free (Node, info); + node->data = NULL; return FALSE; } |