After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 326852 - unref_node isn't doing what it's suppose to do?
unref_node isn't doing what it's suppose to do?
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
unspecified
Other All
: Normal normal
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
Depends on:
Blocks:
 
 
Reported: 2006-01-13 14:46 UTC by Philip Van Hoof
Modified: 2007-01-30 10:55 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Philip Van Hoof 2006-01-13 14:46:22 UTC
Please describe the problem:
I don't really know (not exactly) what the real purpose of the unref_node
function pointer in the GtkTreeModelIfAce is. But if the purpose is to get
launched each time a row in the treeview is no longer "visible", it's not
working correctly.

I created this demo/sample:

https://svn.cronos.be/svn/custom-treemodel-demo/trunk/

Which I can't make a lot shorter. The unref_node stuff only works with custom
models. Building a custom model isn't something that I can do in ten lines of
sample code (else, I would). 

You don't have to assume the code is correct, but please do read it first then.

The unref_node function pointer does in fact get triggered nearly as often as
rows become invisible. But not for 'each' row that becomes invisible.

Or I'm really missing the point of unref_node, or there's problems with it.

Anyway. I'm willing to spend time on this as I need a method to know when a row
becomes invisble.


Steps to reproduce:


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Kristian Rietveld 2006-07-01 22:44:09 UTC
(In reply to comment #0)
> Please describe the problem:
> I don't really know (not exactly) what the real purpose of the unref_node
> function pointer in the GtkTreeModelIfAce is. But if the purpose is to get
> launched each time a row in the treeview is no longer "visible", it's not
> working correctly.

It's used for ref counting nodes.  Operations like adding the node to the internal rbtree (which basically means that the node is visible), creating a row reference, etc, do ref count nodes.  The filter and sort models also reference count nodes when they are added to their internal caches.  A single call to unref_node does not mean that the node is question is immediately invisible.

> I created this demo/sample:
> 
> https://svn.cronos.be/svn/custom-treemodel-demo/trunk/

In your example you are basically uncaching a message header in the unref_node implementation.  You probably want to keep the ref count and only uncache the header when the ref count reaches zero (or when the node is deleted).
Comment 2 Philip Van Hoof 2007-01-30 10:55:09 UTC
Closing this one. Feel free to reopen if you think it's important Kristian.