forked from AuroraMiddleware/gtk
Actually unref the nodes. Fixes bug #50058.
Thu Mar 8 19:18:27 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): Actually unref the nodes. Fixes bug #50058. * gtk/gtktreemodel.c (gtk_tree_model_ref_node): change "::ref_iter" to "::ref_node". (gtk_tree_model_unref_node): change "::unref_iter" to "::unref_node". Fixes bug #50064.
This commit is contained in:
parent
bd10a077cd
commit
8401ea1a21
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
Thu Mar 8 19:18:27 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): Actually
|
||||
unref the nodes. Fixes bug #50058.
|
||||
|
||||
* gtk/gtktreemodel.c (gtk_tree_model_ref_node): change
|
||||
"::ref_iter" to "::ref_node".
|
||||
(gtk_tree_model_unref_node): change "::unref_iter" to
|
||||
"::unref_node". Fixes bug #50064.
|
||||
|
||||
Thu Mar 8 17:40:09 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): add
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Mar 8 19:18:27 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): Actually
|
||||
unref the nodes. Fixes bug #50058.
|
||||
|
||||
* gtk/gtktreemodel.c (gtk_tree_model_ref_node): change
|
||||
"::ref_iter" to "::ref_node".
|
||||
(gtk_tree_model_unref_node): change "::unref_iter" to
|
||||
"::unref_node". Fixes bug #50064.
|
||||
|
||||
Thu Mar 8 17:40:09 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): add
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Mar 8 19:18:27 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): Actually
|
||||
unref the nodes. Fixes bug #50058.
|
||||
|
||||
* gtk/gtktreemodel.c (gtk_tree_model_ref_node): change
|
||||
"::ref_iter" to "::ref_node".
|
||||
(gtk_tree_model_unref_node): change "::unref_iter" to
|
||||
"::unref_node". Fixes bug #50064.
|
||||
|
||||
Thu Mar 8 17:40:09 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): add
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Mar 8 19:18:27 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): Actually
|
||||
unref the nodes. Fixes bug #50058.
|
||||
|
||||
* gtk/gtktreemodel.c (gtk_tree_model_ref_node): change
|
||||
"::ref_iter" to "::ref_node".
|
||||
(gtk_tree_model_unref_node): change "::unref_iter" to
|
||||
"::unref_node". Fixes bug #50064.
|
||||
|
||||
Thu Mar 8 17:40:09 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): add
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Mar 8 19:18:27 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): Actually
|
||||
unref the nodes. Fixes bug #50058.
|
||||
|
||||
* gtk/gtktreemodel.c (gtk_tree_model_ref_node): change
|
||||
"::ref_iter" to "::ref_node".
|
||||
(gtk_tree_model_unref_node): change "::unref_iter" to
|
||||
"::unref_node". Fixes bug #50064.
|
||||
|
||||
Thu Mar 8 17:40:09 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): add
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Mar 8 19:18:27 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): Actually
|
||||
unref the nodes. Fixes bug #50058.
|
||||
|
||||
* gtk/gtktreemodel.c (gtk_tree_model_ref_node): change
|
||||
"::ref_iter" to "::ref_node".
|
||||
(gtk_tree_model_unref_node): change "::unref_iter" to
|
||||
"::unref_node". Fixes bug #50064.
|
||||
|
||||
Thu Mar 8 17:40:09 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): add
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Mar 8 19:18:27 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): Actually
|
||||
unref the nodes. Fixes bug #50058.
|
||||
|
||||
* gtk/gtktreemodel.c (gtk_tree_model_ref_node): change
|
||||
"::ref_iter" to "::ref_node".
|
||||
(gtk_tree_model_unref_node): change "::unref_iter" to
|
||||
"::unref_node". Fixes bug #50064.
|
||||
|
||||
Thu Mar 8 17:40:09 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): add
|
||||
|
@ -876,46 +876,53 @@ gtk_tree_model_iter_parent (GtkTreeModel *tree_model,
|
||||
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_parent) (tree_model, iter, child);
|
||||
}
|
||||
|
||||
/* FIXME explain what the method is supposed to do! */
|
||||
/**
|
||||
* gtk_tree_model_ref_iter:
|
||||
* gtk_tree_model_ref_node:
|
||||
* @tree_model: A #GtkTreeModel.
|
||||
* @iter: The #GtkTreeIter.
|
||||
*
|
||||
* Ref's the iter. This is an optional method for models to implement. To be
|
||||
* more specific, models may ignore this call as it exists primarily for
|
||||
* performance reasons.
|
||||
* Lets the tree ref the node. This is an optional method for models to
|
||||
* implement. To be more specific, models may ignore this call as it exists
|
||||
* primarily for performance reasons.
|
||||
*
|
||||
* This function is primarily meant as a way for views to let caching model know
|
||||
* when nodes are being displayed (and hence, whether or not to cache that
|
||||
* node.) For example, a file-system based model would not want to keep the
|
||||
* entire file-heirarchy in memory, just the sections that are currently being
|
||||
* displayed by every current view.
|
||||
**/
|
||||
void
|
||||
gtk_tree_model_ref_iter (GtkTreeModel *tree_model,
|
||||
gtk_tree_model_ref_node (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
g_return_if_fail (tree_model != NULL);
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
||||
|
||||
if (GTK_TREE_MODEL_GET_IFACE (tree_model)->ref_iter)
|
||||
(* GTK_TREE_MODEL_GET_IFACE (tree_model)->ref_iter) (tree_model, iter);
|
||||
if (GTK_TREE_MODEL_GET_IFACE (tree_model)->ref_node)
|
||||
(* GTK_TREE_MODEL_GET_IFACE (tree_model)->ref_node) (tree_model, iter);
|
||||
}
|
||||
|
||||
/* FIXME explain what the method is supposed to do! */
|
||||
/**
|
||||
* gtk_tree_model_unref_iter:
|
||||
* gtk_tree_model_unref_node:
|
||||
* @tree_model: A #GtkTreeModel.
|
||||
* @iter: The #GtkTreeIter.
|
||||
*
|
||||
* Unref's the iter. This is an optional method for models to implement. To be
|
||||
* more specific, models may ignore this call as it exists primarily for
|
||||
* performance reasons.
|
||||
* Lets the tree unref the node. This is an optional method for models to
|
||||
* implement. To be more specific, models may ignore this call as it exists
|
||||
* primarily for performance reasons.
|
||||
*
|
||||
* For more information on what this means, please see #gtk_tree_model_ref_node.
|
||||
* Please note that nodes that are deleted are not unreffed.
|
||||
**/
|
||||
void
|
||||
gtk_tree_model_unref_iter (GtkTreeModel *tree_model,
|
||||
gtk_tree_model_unref_node (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
g_return_if_fail (tree_model != NULL);
|
||||
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
|
||||
|
||||
if (GTK_TREE_MODEL_GET_IFACE (tree_model)->unref_iter)
|
||||
(* GTK_TREE_MODEL_GET_IFACE (tree_model)->unref_iter) (tree_model, iter);
|
||||
if (GTK_TREE_MODEL_GET_IFACE (tree_model)->unref_node)
|
||||
(* GTK_TREE_MODEL_GET_IFACE (tree_model)->unref_node) (tree_model, iter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,9 +103,9 @@ struct _GtkTreeModelIface
|
||||
gboolean (* iter_parent) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *child);
|
||||
void (* ref_iter) (GtkTreeModel *tree_model,
|
||||
void (* ref_node) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
void (* unref_iter) (GtkTreeModel *tree_model,
|
||||
void (* unref_node) (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
};
|
||||
|
||||
@ -194,9 +194,9 @@ gboolean gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model,
|
||||
gboolean gtk_tree_model_iter_parent (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *child);
|
||||
void gtk_tree_model_ref_iter (GtkTreeModel *tree_model,
|
||||
void gtk_tree_model_ref_node (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_tree_model_unref_iter (GtkTreeModel *tree_model,
|
||||
void gtk_tree_model_unref_node (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_tree_model_get (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
|
@ -97,9 +97,9 @@ static gboolean gtk_tree_model_sort_iter_nth_child (GtkTreeModel *
|
||||
static gboolean gtk_tree_model_sort_iter_parent (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *child);
|
||||
static void gtk_tree_model_sort_ref_iter (GtkTreeModel *tree_model,
|
||||
static void gtk_tree_model_sort_ref_node (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
static void gtk_tree_model_sort_unref_iter (GtkTreeModel *tree_model,
|
||||
static void gtk_tree_model_sort_unref_node (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
|
||||
/* Internal functions */
|
||||
@ -184,8 +184,8 @@ gtk_tree_model_sort_tree_model_init (GtkTreeModelIface *iface)
|
||||
iface->iter_n_children = gtk_tree_model_sort_iter_n_children;
|
||||
iface->iter_nth_child = gtk_tree_model_sort_iter_nth_child;
|
||||
iface->iter_parent = gtk_tree_model_sort_iter_parent;
|
||||
iface->ref_iter = gtk_tree_model_sort_ref_iter;
|
||||
iface->unref_iter = gtk_tree_model_sort_unref_iter;
|
||||
iface->ref_node = gtk_tree_model_sort_ref_node;
|
||||
iface->unref_node = gtk_tree_model_sort_unref_node;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -843,13 +843,13 @@ gtk_tree_model_sort_iter_parent (GtkTreeModel *tree_model,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_sort_ref_iter (GtkTreeModel *tree_model,
|
||||
gtk_tree_model_sort_ref_node (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_sort_unref_iter (GtkTreeModel *tree_model,
|
||||
gtk_tree_model_sort_unref_node (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
|
||||
|
@ -180,6 +180,8 @@ static void gtk_tree_view_deleted (GtkTreeModel *model,
|
||||
gpointer data);
|
||||
|
||||
/* Internal functions */
|
||||
static void gtk_tree_view_unref_tree (GtkTreeView *tree_view,
|
||||
GtkRBTree *tree);
|
||||
static void gtk_tree_view_queue_draw_node (GtkTreeView *tree_view,
|
||||
GtkRBTree *tree,
|
||||
GtkRBNode *node,
|
||||
@ -1951,6 +1953,8 @@ gtk_tree_view_button_release (GtkWidget *widget,
|
||||
tree_view->priv->button_pressed_node->children,
|
||||
&iter,
|
||||
gtk_tree_path_get_depth (path));
|
||||
gtk_tree_view_unref_tree (GTK_TREE_VIEW (widget),
|
||||
tree_view->priv->button_pressed_node->children);
|
||||
_gtk_rbtree_remove (tree_view->priv->button_pressed_node->children);
|
||||
}
|
||||
gtk_tree_path_free (path);
|
||||
@ -2701,7 +2705,7 @@ gtk_tree_view_inserted (GtkTreeModel *model,
|
||||
goto done;
|
||||
|
||||
/* ref the node */
|
||||
gtk_tree_model_ref_iter (tree_view->priv->model, iter);
|
||||
gtk_tree_model_ref_node (tree_view->priv->model, iter);
|
||||
max_height = gtk_tree_view_insert_iter_height (tree_view,
|
||||
tree,
|
||||
iter,
|
||||
@ -2935,7 +2939,7 @@ gtk_tree_view_build_tree (GtkTreeView *tree_view,
|
||||
iter,
|
||||
depth);
|
||||
|
||||
gtk_tree_model_ref_iter (tree_view->priv->model, iter);
|
||||
gtk_tree_model_ref_node (tree_view->priv->model, iter);
|
||||
temp = _gtk_rbtree_insert_after (tree, temp, max_height);
|
||||
if (recurse)
|
||||
{
|
||||
@ -3351,6 +3355,58 @@ _gtk_tree_view_find_node (GtkTreeView *tree_view,
|
||||
while (1);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_view_unref_tree_helper (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
GtkRBTree *tree,
|
||||
GtkRBNode *node)
|
||||
{
|
||||
do
|
||||
{
|
||||
g_return_if_fail (node != NULL);
|
||||
|
||||
if (node->children)
|
||||
{
|
||||
GtkTreeIter child;
|
||||
GtkRBTree *new_tree;
|
||||
GtkRBNode *new_node;
|
||||
|
||||
new_tree = node->children;
|
||||
new_node = new_tree->root;
|
||||
|
||||
while (new_node && new_node->left != new_tree->nil)
|
||||
new_node = new_node->left;
|
||||
|
||||
g_return_if_fail (gtk_tree_model_iter_children (model, &child, iter));
|
||||
gtk_tree_view_unref_tree_helper (model, &child, new_tree, new_node);
|
||||
}
|
||||
|
||||
gtk_tree_model_unref_node (model, iter);
|
||||
node = _gtk_rbtree_next (tree, node);
|
||||
}
|
||||
while (gtk_tree_model_iter_next (model, iter));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_view_unref_tree (GtkTreeView *tree_view,
|
||||
GtkRBTree *tree)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath *path;
|
||||
GtkRBNode *node;
|
||||
|
||||
node = tree->root;
|
||||
while (node && node->left != tree->nil)
|
||||
node = node->left;
|
||||
|
||||
g_return_if_fail (node != NULL);
|
||||
path = _gtk_tree_view_find_path (tree_view, tree, node);
|
||||
gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_view->priv->model),
|
||||
&iter, path);
|
||||
gtk_tree_view_unref_tree_helper (GTK_TREE_MODEL (tree_view->priv->model), &iter, tree, node);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_view_queue_draw_node (GtkTreeView *tree_view,
|
||||
GtkRBTree *tree,
|
||||
|
Loading…
Reference in New Issue
Block a user