TreeViewContentComponent assert


#1

Hi

There was a post that seemed like it might be related to this ( http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=5685 ) but i created new one since it wasn’t exactly the same thing.

I am hitting the assert in Component::isParentOf() because the TreeViewContentComponent is keeping a component in its rowComponents arrays during updateComponents(), in a situation where i’m setting the root item o f the tree to NULL (right before I delete it). It appears to be happening because isMouseDraggingInChildCompOf() is true (i’m rebuilding the tree based on user interaction with the tree itself).

So once i’ve done setRootItem(0), i delete my old root item, but the TreeViewContentComponent is left with pointer to a deleted tree component, and the next time the tree is updated i get the assert failure.

Hope that made sense - Any ideas what the best way to fix this is?


#2

Hmm, ok, I think this may be very easy to fix, by changing the array to use safe pointers:


#3

I haven’t grabbed the latest version in a month or so, but am I right in saying SafePointer and Array aren’t compatible right now? it looks like Array uses memmoves to move stuff around, and that messes up the ComponentListener pointers. Making the changes above causes crashes on startup of our app, and i think thats the reason.

I guess the array could hold pointers to SafePointers(!) or maybe its worth having a variant of Array that will use copy constructors to copy members (like STL containers do - sure, its a lot slower, but kinda necessary for this kind of thing)


#4

Yes, after writing that I realised the Array wouldn’t work, so I did some proper refactoring of the TreeView code (it needed a bit of tidying up in there anyway…) Try the latest version now.


#5

Cool - thanks! Will sync, and check it out as soon as I get a chance (unfortunately got sidetracked onto non-juce-y things…)