Georg Wünsch wrote:
> Hi Marcus,
> 
> 
> The exeption is a exeption (first Chance) at ... in main.exe: 0xC0000005:
> access violation at Position 0x00000000.

Ok. Something is null or not initialized. I'm guessing threading/aspect 
management based on later stuff in your e-mail.

> I have changed the code a bit and it crashes deep inside OSGSystemD.dll, and
> I am having no clue.

Posting a stack trace would be help. Also, using a debugger and inspect 
the values of variables on the way helps too.

> I guess I am doing wrong something very basic, so I would like to follow
> your guesses:
> 
> How can I "make sure the myTransform ptr is correct"?

Set a breakpoint and inspect in debugger, or just print it to stdout. It 
should not be null nor a pattern like 0xfeeefeee or 0xcdcdcdcd. 
(Likewise for the this ptr)

> How do I set an OpenSG aspect and initialize it for the current thread, as
> you said?

OSG::ExternalThread::get(0)->initialize(aspect); // aspect is an int

For subsequent get/set, you should be able to use 
OSG::Thread::getCurrent()->getAspect() / setAspect() I think. I haven't 
messed with that too much.

> My first approach was to simply use qt's qtconcurrent framework to go
> multithreading. I understand that I have to use native threads with opensg?

QTConcurrent might work fine, but as each job there will be run by a 
different thread, you must make sure the OpenSG aspect is initialized 
and correct in each of these threads before running each job involving 
OpenSG multithreading. (i.e. any smart Ptr in 1.x or MTPtr's in 2.x)

So, the function you send to QtConcurrent::map (or whatever you're 
using) needs to first set the aspect for the thread, then do whatever 
you want it to do.

On Windows in our app, I've added the initialize code in a dllmain() 
function in one of my dll's, so any thread that the application creates 
is automatically initialized for OpenSG-work. However, it doesn't help 
if different externally created threads needs different aspects, then I 
need to set that before running any OpenSG code to make sure the right 
values are accessed.

Cheers,
/Marcus


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to