[gtk+] Be more careful when freeing ui manager nodes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Be more careful when freeing ui manager nodes
- Date: Wed, 16 May 2012 01:53:27 +0000 (UTC)
commit 04b92a799ebbebc534a72b85a76a39089d77f3d3
Author: Matthias Clasen <mclasen redhat com>
Date: Tue May 15 21:49:24 2012 -0400
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.
gtk/gtkuimanager.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkuimanager.c b/gtk/gtkuimanager.c
index bb0137f..c80df7c 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]