GNOME Bugzilla – Bug 326852
unref_node isn't doing what it's suppose to do?
Last modified: 2007-01-30 10:55:09 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:
(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).
Closing this one. Feel free to reopen if you think it's important Kristian.