From: Axel S. <A....@ke...> - 2007-12-04 21:36:24
|
Tue Dec 4 13:26:16 PST 2007 A....@ke... * Fix stamp problems in tree implementation. The story of TreeIter stamps is as follows: ListStore doesn't use them since the iterators remain valid throughout. TreeStore needs to invalidate the iterators each time a node is inserted since a new node might mean that it can't be indexed anymore with the available number of bits at that level. The function that inserts nodes correctly invalidated the tree iterators. However, this function also calls methods in TreeModel, passing in order to notify itself and the view. The passed in TreeIters have no stamp set, thus a warning is raised as soon as these tree iters get back to the model, usually in a form of ref'ing the node. This was slightly confusing as setting the stamp was so far automatically done in the C interface Gtk2HsStore.c. The stamp is now set explicity in the TreeIters before they are passed to the functions in the model. hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 43 + customTreeModelGetStamp, hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 589 + if (result) iter->stamp = store->stamp; hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 475 + stamp <- customTreeModelGetStamp model hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 478 - in treeModelRowInserted model p' iter + in treeModelRowInserted model p' (treeIterSetStamp iter stamp) hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 482 - when toggle $ treeModelRowHasChildToggled model path iter + when toggle $ treeModelRowHasChildToggled model path + (treeIterSetStamp iter stamp) hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 629 - when found $ treeModelRowChanged model path iter + stamp <- customTreeModelGetStamp model + when found $ treeModelRowChanged model path (treeIterSetStamp iter stamp) hunk ./gtk/Graphics/UI/Gtk/ModelView/Types.chs 39 + treeIterSetStamp, hunk ./gtk/Graphics/UI/Gtk/ModelView/Types.chs 132 +-- update the stamp of a tree iter +treeIterSetStamp :: TreeIter -> CInt -> TreeIter +treeIterSetStamp (TreeIter _ a b c) s = (TreeIter s a b c) + |