This is done in the same way as GArray was replaced with GSequence in
GtkTreeModelFilter, in a patch done by Xavier Claessens.
All sorting code has been reworked to use the GSequence sorting
and insert sort functions, instead of doing a lot on our own.
Now that we call unref_node in free_level, we have to take care that
free_level may only unref (parent) nodes when these still exist in the
child model. After row-deleted has been received for a node, its
children may no longer unref this node.
Referencing a parent node for each referenced node is overdone. Instead,
we now reference the parent from build_level and unreference in free_level.
Each level keeps a single reference on its immediate parent. This both
alleviates the performence problems and should perfectly serve the purpose.
This commit was created using a script that searched for all docstrings
containing a parameter and the string 'or %NULL'.
Gdk backends and demos excluded as they are not part of a public API
https://bugzilla.gnome.org/show_bug.cgi?id=610474
Rework the sort and filter models to store their reference to the parent
element as an array index instead of a pointer to an array element.
These pointers could become invalid with any array modification, whereas
indices do not.
Added checks to see whether the passed iterators are not the same in
convert_child_iter_to_iter() and iter_to_child_iter() functions in both
the sort and filter models.
Fixes bug 573321, suggestion by Vadim Godunko.
2008-05-28 Kristian Rietveld <kris@imendio.com>
Amendment of bug 485218 - Strange warning encountered.
* gtk/gtktreemodelsort.[ch]
(gtk_tree_model_sort_convert_child_iter_to_iter): return a boolean
indication whether or not the conversion had succeeded.
svn path=/trunk/; revision=20204
2007-03-10 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_ref_node),
(gtk_tree_model_sort_real_unref_node): when (un)reffing an
element, also (un)ref its parent elements. (Fixes#364946,
reported by many, testcase by Andreas Koehler).
svn path=/trunk/; revision=17457
2006-09-26 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed),
(gtk_tree_model_sort_sort_level): ref count nodes the proper way,
(gtk_tree_model_sort_ref_node), (gtk_tree_model_sort_real_unref_node),
(gtk_tree_model_sort_free_level): bring zero ref count loops in
sync,
(gtk_tree_model_sort_free_level): free child levels before
decreasing the zero ref count of the current level,
(gtk_tree_model_sort_clear_cache): only clear cache if zero_ref_count
is > 0.
2006-02-08 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_ref_path),
(gtk_tree_model_filter_unref_path): free temporary paths after
usage (patch from maemo-gtk),
(gtk_tree_model_filter_clear_cache): fix little typo in the docs
(patch from maemo-gtk).
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_deleted): remove
stale FIXME.
2006-01-14 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_iter_children): fix
a typo which caused this whole thing to not function ...