Commit 7014ef00 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

Fix two memory handling problems in GtkTreeView: (#322350, Søren

2005-11-27  Matthias Clasen  <mclasen@redhat.com>

	Fix two memory handling problems in GtkTreeView: (#322350,
	Søren Sandmann)

	* gtk/gtktreeview.c (gtk_tree_view_destroy)
	(gtk_tree_view_set_model): Remove all references to nodes in
	the old model.
	(gtk_tree_view_real_collapse_row): Unmark expanded_collapsed_node
	before removing the children.
parent 66627293
2005-11-27 Matthias Clasen <mclasen@redhat.com>
Fix two memory handling problems in GtkTreeView: (#322350,
Søren Sandmann)
* gtk/gtktreeview.c (gtk_tree_view_destroy)
(gtk_tree_view_set_model): Remove all references to nodes in
the old model.
(gtk_tree_view_real_collapse_row): Unmark expanded_collapsed_node
before removing the children.
* gtk/gtkcolorbutton.c (gtk_color_button_init): Don't leak a
PangoLayout here. (#322505, Paolo Borelli)
......
2005-11-27 Matthias Clasen <mclasen@redhat.com>
Fix two memory handling problems in GtkTreeView: (#322350,
Søren Sandmann)
* gtk/gtktreeview.c (gtk_tree_view_destroy)
(gtk_tree_view_set_model): Remove all references to nodes in
the old model.
(gtk_tree_view_real_collapse_row): Unmark expanded_collapsed_node
before removing the children.
* gtk/gtkcolorbutton.c (gtk_color_button_init): Don't leak a
PangoLayout here. (#322505, Paolo Borelli)
......
......@@ -1313,6 +1313,20 @@ gtk_tree_view_finalize (GObject *object)
/* GtkObject Methods
*/
static void
gtk_tree_view_free_rbtree (GtkTreeView *tree_view)
{
_gtk_rbtree_free (tree_view->priv->tree);
tree_view->priv->tree = NULL;
tree_view->priv->button_pressed_node = NULL;
tree_view->priv->button_pressed_tree = NULL;
tree_view->priv->prelight_tree = NULL;
tree_view->priv->prelight_node = NULL;
tree_view->priv->expanded_collapsed_node = NULL;
tree_view->priv->expanded_collapsed_tree = NULL;
}
static void
gtk_tree_view_destroy (GtkObject *object)
{
......@@ -1337,8 +1351,8 @@ gtk_tree_view_destroy (GtkObject *object)
if (tree_view->priv->tree != NULL)
{
gtk_tree_view_unref_and_check_selection_tree (tree_view, tree_view->priv->tree);
_gtk_rbtree_free (tree_view->priv->tree);
tree_view->priv->tree = NULL;
gtk_tree_view_free_rbtree (tree_view);
}
if (tree_view->priv->selection != NULL)
......@@ -9464,15 +9478,7 @@ gtk_tree_view_set_model (GtkTreeView *tree_view,
tree_view->priv->model);
if (tree_view->priv->tree)
{
_gtk_rbtree_free (tree_view->priv->tree);
tree_view->priv->tree = NULL;
}
tree_view->priv->prelight_node = NULL;
tree_view->priv->prelight_tree = NULL;
tree_view->priv->button_pressed_node = NULL;
tree_view->priv->button_pressed_tree = NULL;
gtk_tree_view_free_rbtree (tree_view);
gtk_tree_row_reference_free (tree_view->priv->drag_dest_row);
tree_view->priv->drag_dest_row = NULL;
......@@ -10966,6 +10972,14 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
gtk_tree_path_free (lsc);
}
if (tree_view->priv->expanded_collapsed_node != NULL)
{
GTK_RBNODE_UNSET_FLAG (tree_view->priv->expanded_collapsed_node, GTK_RBNODE_IS_SEMI_EXPANDED);
GTK_RBNODE_UNSET_FLAG (tree_view->priv->expanded_collapsed_node, GTK_RBNODE_IS_SEMI_COLLAPSED);
tree_view->priv->expanded_collapsed_node = NULL;
}
if (gtk_tree_view_unref_and_check_selection_tree (tree_view, node->children))
{
_gtk_rbtree_remove (node->children);
......@@ -10980,14 +10994,6 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
tree_view->priv->expand_collapse_timeout = 0;
}
if (tree_view->priv->expanded_collapsed_node != NULL)
{
GTK_RBNODE_UNSET_FLAG (tree_view->priv->expanded_collapsed_node, GTK_RBNODE_IS_SEMI_EXPANDED);
GTK_RBNODE_UNSET_FLAG (tree_view->priv->expanded_collapsed_node, GTK_RBNODE_IS_SEMI_COLLAPSED);
tree_view->priv->expanded_collapsed_node = NULL;
}
if (animate)
{
tree_view->priv->expand_collapse_timeout = g_timeout_add (50, expand_collapse_timeout, tree_view);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment