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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to