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.
This commit is contained in:
Matthias Clasen 2012-05-15 21:49:24 -04:00
parent b7cf588f6e
commit 04b92a799e

View File

@ -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);
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_list_free_full (info->uifiles, node_ui_reference_free);
info->uifiles = NULL;
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;
}