I am replacing the OpenGL code of my C++ app with code that uses OpenSceneGraph.
The app is based on Qt and using Qt Threads.
The main thread is calling the viewer->frame()
while other threads are loading data.
Those threads directly works whith my scene graph, adding node with addChild()
.
But sometimes this group->addChild
call make my app crash. I Can see, in the stacktrace, the group's vector containing the children is resizing.
I guess that I'm not supposed to add childrens in one thread while another may be drawing it. Am I right ?
What is the best way to do it ? Using a update callback ? Locking the main thread ?