|
From: Carsten N. <car...@gm...> - 2008-06-09 21:10:24
|
Hello Timm, Timm Drevensek wrote: > Hy, > > i’d tryed to use some OpenSG 1.8 Image inside a Boost Thread and I > always get a crash :( > > Example, inside some boost Thread: > > osg::ImagePtr blubber; (created, filled etc.) > > Int blah = blubber->getWidth(); << crash > > Stepped around a bit and found the source of the crash: > OSGFieldContainerPtr::operator->::(getElemP(Thread::getAspect())) > pUint = (UInt32 *) TlsGetValue(_aspectKey); > > return *pUint; > > Problem is, that *pUint is always 0 ans dereferencing 0 does not work :( > Is there a workaround to use Boost Threads & OpenSG? OpenSG threads are associated to an aspect (think of it as a lazy copy of the scene graph). For external threads you have to establish this association manually by telling OpenSG about your external thread: OSG::ExternalThread *tr; tr = OSG::ExternalThread::get(NULL); tr->initialize (0); // 0 == OpenSG Aspect you want to use Hope it helps, Carsten |