TreeView crash on OS X

I’m wondering what made it crash, happened 2 times now. What could it be? This is JUCE V1.46.
Basically, I’m doing this in a Thread (not the main GUI Thread):

using MessageManagerLock then adding subItem via TreeViewItem::addSubItem()

I guess it crashes because somewhere there’s repaint() called in it? Should I use callFunctionOnMessageThread() ?

Thread 6 Crashed:
0 0x96a41d9f shape_union + 687
1 0x96a4a074 CGSUnionRegion + 264
2 0x93b85a75 CreateUnion(__HIShape
const*, __HIShape const*, void**) + 57
3 0x93b89106 HIShapeCreateUnion + 36
4 0x9389b590
HIView::Invalidate(__HIShape const*) + 346
5 0x939030e5
HIViewSetNeedsDisplayInRect + 113
6 com.schaack.touch 0x001d6b88
juce::HIViewComponentPeer::repaint(int, int, int, int) + 236
7 com.schaack.touch 0x0009706b
juce::Component::repaint() + 93
8 com.schaack.touch 0x0009920e
juce::Component::setBounds(int, int, int, int) + 438
9 com.schaack.touch 0x000996c3
juce::Component::setBounds(juce::Rectangle const&) + 47
10 com.schaack.touch 0x001e371c
juce::TreeViewContentComponent::updateComponents() + 880
11 com.schaack.touch 0x000924c0
juce::TreeView::handleAsyncUpdate() + 98
12 com.schaack.touch 0x000927e9
juce::TreeViewItem::addSubItem(juce::TreeViewItem*, int) + 569
13 com.schaack.touch 0x000439f8
QuadFileTreeComponent::run() + 426
14 com.schaack.touch 0x000faa42
juce::Thread::threadEntryPoint(juce::Thread*) + 274
15 com.schaack.touch 0x00074679
juce::threadEntryProc(void*) + 17
16 libSystem.B.dylib 0x94bf8095 _pthread_start + 321
17 libSystem.B.dylib 0x94bf7f52 thread_start + 34

It would be nice to have a Thread-safe addSubItem()…

No idea, but as this is all defunct carbon code, I can’t really offer to spend any time investigating…

What has Thread-safety of TreeViewItem::addSubItem() to do with Carbon?
The code is just not Thread-safe because repaint() is called in there (and maybe other functions that are not Thread-safe).

Sorry, I thought you were asking why it had crashed there.

Well, you could always just wrap a messagemanagerlock around your call to addSubItem. I can’t easily add that to the treeview because to avoid deadlocks, you’d need to pass your thread to the messagemanagerlock constructor.

I did put a MessageManagerLock around it. It still crashed! (That was written, too in my original message!). So, now, I want to know: what can this be?

MessageManagerLocks have changed a lot since the old days of 1.46, and I suspect that it might not have been correctly locking it for you.

Sorry to up that, I encounter the same things.

Zamrate: did you solve that with a MessageListener ?