Commit Graph

28586 Commits

Author SHA1 Message Date
Kristian Høgsberg
005894eccb wayland: We need to require egl as well 2011-08-22 16:32:06 -04:00
Kristian Rietveld
a91868496a Fix typo in doc comment 2011-08-22 21:30:35 +02:00
Kristian Rietveld
b50375abf4 Add forgotten calls to signal_monitor_assert_is_empty() 2011-08-22 21:30:35 +02:00
Kristian Rietveld
d63015e627 Fix some memory leaks in treemodel unit tests 2011-08-22 21:30:35 +02:00
Kristian Rietveld
b31c3f1c1f treemodelsort: eliminate unread variable assigments
Courtesy of scan-build/clang.
2011-08-22 21:30:35 +02:00
Kristian Rietveld
584ff7c29a treemodelfilter: eliminate unread variable assigments
Courtesy of scan-build/clang.
2011-08-22 21:30:35 +02:00
Kristian Rietveld
36f712f272 Add some notes on how filter model testing can be made (even) more thorough 2011-08-22 21:30:34 +02:00
Kristian Rietveld
04885f1c29 Update filtermodel ref count unit tests to new cache depth 2011-08-22 21:30:34 +02:00
Kristian Rietveld
089edcf765 Fix bad typo in gtk_tree_model_filter_build_level() ... 2011-08-22 21:30:34 +02:00
Kristian Rietveld
6cd134d39e gtktreemodelfilter: only maintain cache at 1 level depth instead of 2 2011-08-22 21:30:34 +02:00
Kristian Rietveld
aa9151a6ee Extend public and internal documentation about GtkTreeModelFilter 2011-08-22 21:30:34 +02:00
Kristian Rietveld
52faf1f984 Extend documentation about GtkTreeModelSort internals 2011-08-22 21:30:34 +02:00
Kristian Rietveld
85d4a5abc7 GtkTreeModel: add more detailed documentation on reference counting 2011-08-22 21:30:34 +02:00
Kristian Rietveld
60d031e311 Replace GArray with GSequence in GtkTreeModelSort
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.
2011-08-22 21:30:34 +02:00
Kristian Rietveld
ad0f54b87b Add more unit tests for GtkTreeModelSort
To test ref counting during rows-reordered and the new_order arrays supplied
with rows-reordered signals.
2011-08-22 21:30:34 +02:00
Kristian Rietveld
9ef07cb0f3 Move SignalMonitor to treemodel.[ch] so it can be used by other tests 2011-08-22 21:30:34 +02:00
Kristian Rietveld
97b1f34868 Revert usage of parent_elt_index back to parent_elt pointers
Based on earlier patch for GtkTreeModelFilter by Xavier Claessens.
2011-08-22 21:30:33 +02:00
Xavier Claessens
bee3d5f143 Replace GArray with GSequence in GtkTreeModelFilter
Significantly improves performance when e.g. removing (filtering) a lot
of rows from the filter model.  Fixes bug 616871.

This commit includes changes by Kristian Rietveld to make the patch apply
on top of the treemodel-fix branch and pass all newly written unit tests.
2011-08-22 21:30:33 +02:00
Xavier Claessens
eb594da2f2 Revert usage of parent_elt_index back to parent_elt pointers
This was introduced in commit a59c39f370.
The revert is part of bug 616871.  Adaption to recent GtkTreeModelFilter
changes by Kristian Rietveld.
2011-08-22 21:30:33 +02:00
Kristian Rietveld
510d84f682 Do not emit rows-reordered for levels with no visible rows 2011-08-22 21:30:33 +02:00
Kristian Rietveld
21d7eca12a Remove left-over dump call 2011-08-22 21:30:33 +02:00
Kristian Rietveld
3b7aed050d Correct ref transfer in GtkTreeModelFilter rows-reordered handling 2011-08-22 21:30:33 +02:00
Kristian Rietveld
30340e521e Test GtkTreeModelFilter's reference transfers 2011-08-22 21:30:33 +02:00
Kristian Rietveld
e321034074 Unit test GtkTreeModelFilter's rows-reordered emissions 2011-08-22 21:30:33 +02:00
Kristian Rietveld
bcc1fd7efd Unit test rows reordered ref count handling in GtkTreeView 2011-08-22 21:30:32 +02:00
Kristian Rietveld
0ee6141cf6 Should validate TreeModelRefCount before the sort and filter model 2011-08-22 21:30:32 +02:00
Kristian Rietveld
9e2fbca594 Add reference counting unit tests for GtkTreeModelFilter 2011-08-22 21:30:32 +02:00
Kristian Rietveld
f42de9e52a Add more "has child" unit tests
This allows for more thorough testing of "has child" filter functions.
We also test a has child filter function with a sort model as
child model, to verify that we receive enough signals to function
properly.
2011-08-22 21:30:32 +02:00
Kristian Rietveld
504d6715c1 Add cleaned up and easier version of unit test for bug 311955 2011-08-22 21:30:32 +02:00
Kristian Rietveld
35e09df282 Check level length in unit test for bug 311955 2011-08-22 21:30:32 +02:00
Kristian Rietveld
59efa6acdd Remove checks for superfluous signals which are not longer emitted 2011-08-22 21:30:32 +02:00
Kristian Rietveld
b161328682 Correct/expand base tests to check emitted signals
The filter model is now more strict about the signals which are emitted,
so the base tests have been expanded to test with both the root level
nodes collapsed and expanded.
2011-08-22 21:30:32 +02:00
Kristian Rietveld
1158ed5795 treemodelrefcount: check_iter(): check if iter is valid 2011-08-22 21:30:32 +02:00
Kristian Rietveld
07d99d26b2 treemodelrefcount: make it possible to assert within check functions 2011-08-22 21:30:32 +02:00
Kristian Rietveld
88dd6372b0 treemodelfilter: rework reference counting
- Before we kept a reference on all nodes in non-root levels.  This has
   been changed, now we keep a reference on the first node of each level.
   If, due to changes in the model, another node becomes the first node in
   the level, the reference is transferred to this new first node.
 - All non-root levels keep a reference on their parent.
 - By making use of the external ref count, the filter model now emits less
   unnecessary signals.
 - GtkTreeModelFilter does support filter functions which decide visibility
   of a given node based on the number of or visibility of children.
   To accomplish this, a child level of a node is cached when its
   parent has an external ref count > 0, because changes to the node might
   affect this parent.
 - An optimization for not building the root level in case the inserted
   node is not visible in gtk_tree_model_filter_row_inserted() has been
   removed.  In this case, we still need to build the root level and
   possibly a child level to monitor for signals which might make
   this row visible.
2011-08-22 21:30:32 +02:00
Kristian Rietveld
2984e22ef0 treemodelfilter: handle another case in check_ancestors
In gtk_tree_model_filter_check_ancestors(), also handle the case when
a node is already in the cache, but invisible, in the root level.
With the upcoming changes to GtkTreeModelFilter's ref counting this
case can occur.
2011-08-22 21:30:32 +02:00
Kristian Rietveld
52de413d43 treemodelfilter: guard for building already existing levels 2011-08-22 21:30:32 +02:00
Kristian Rietveld
dc15124c6f treemodelfilter: Introduce notion of external ref count
We need to distinguish between the ref count objects have on us versus
the ref count we have on our child model.  To keep track of the former,
we introduce the "external ref count" in this commit.  The zero_ref_count
needs to be determined from the external ref count, because objects that
have a ref count on us have say in which levels must be cached and which
can be released.

Before the caching in GtkTreeModelFilter was essentially broken and
levels were never released.  This was caused because the zero_ref_count
was connected to the ref count the filter model had on its child model.
Now that this depends on the external ref count, this is working fine and
as to be expected.
2011-08-22 21:30:32 +02:00
Kristian Rietveld
058a9090c2 treemodelfilter: Move more missions of row-deleted down
The row-deleted signal should be emitted after the internal data
structures have been updated.  In gtk_tree_model_filter_remove_elt_from_level
and gtk_tree_model_filter_virtual_root_deleted the signal was still being
emitted before the updates were carried out.
2011-08-22 21:30:32 +02:00
Kristian Rietveld
cac5d60633 Unit test reference counting in GtkTreeModelSort 2011-08-22 21:30:31 +02:00
Kristian Rietveld
dec7a34047 Avoid unreferencing deleted nodes
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.
2011-08-22 21:30:31 +02:00
Kristian Rietveld
7677e2d4e3 Bug 611922 - gtk_tree_model_sort_ref_node() is too slow
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.
2011-08-22 21:30:31 +02:00
Kristian Rietveld
d241323b08 Move asserts to gtktreemodelrefcount.h for other unit tests to use 2011-08-22 21:30:31 +02:00
Kristian Rietveld
bda09159c3 Add generic GtkTreeModel reference counting unit tests 2011-08-22 21:30:31 +02:00
Kristian Rietveld
1cb14a16b7 Add GtkTreeModelRefCount, only to be used in unit tests 2011-08-22 21:30:31 +02:00
Kristian Rietveld
b8752210ba treemodelsort: Remove unnecessary comment
(I am no longer 17 years old and have grown up by now).
2011-08-22 21:30:31 +02:00
Kristian Rietveld
a485334c37 Add some comments to gtk_tree_model_filter_remove_elt_from_level 2011-08-22 21:30:31 +02:00
Kristian Rietveld
e89782742d Fix a couple of memleaks in the filter model tests
(Not all of them yet, need to do the remainder on Linux since valgrind
on Mac OS X is a bit too noisy).
2011-08-22 21:30:31 +02:00
Kristian Rietveld
76cfd8bfac Bug 621076 - GtkTreeModelFilter does not emit all signals in some ...
The bulk of the fix is to walk the chain of ancestors, starting at the
root level, and check if the visibility of any of the ancestors has
changed.  If yes, the necessary signals are emitted so that this change
is propagated properly.  This walk is done after a node has been
inserted, changed or deleted, see function
gtk_tree_model_filter_check_ancestors().

Bug reported, and initial debugging and analysis, by Xavier Claessens.
2011-08-22 21:30:31 +02:00
Kristian Rietveld
c8783d3339 Decrease code duplication in _remove_elt_from_level take two 2011-08-22 21:30:31 +02:00