Hello Marcus,
Marcus Lindblom wrote:
> Carsten Neumann wrote:
>
>> yes, that matches my understanding as well. What I don't get anymore at
>> this point is why it crashes anyways. AFAICS we don't do anything wrong.
>> By the time osgInit runs the pointer objects should be constructed and
>> from the standard quote Gerrit posted, any atexit handler registered by
>> osgInit should then run *before* the pointer objects are destroyed. This
>> order of events is fine, I think. I'm confused.
>
> I agree with your analysis here. So, I'm confused too (if it helps :)
>
> Are you able to see _when_ the materials are destroyed the first time?
> There's no third culprit involved?
that's a good point, I'll debug it again from that POV.
> Because the objects seem to be destroyed before running osgexit(),
> without the ptr's being null.
>
> (Also, are the MTRefPtr's nulled in their dtor? I don't think so.
> Perhaps that's a good idea to avoid accessing stale objects?)
yes, I've tried that and it prevents the crash, because the assignment
in subRefDefaultMaterial simply does nothing. However, the assignment
itself makes use of the _defaultMaterial pointer object, which is (or at
least seems to be) dead at that point. So setting the MTRefPtr::_pObj to
NULL solves the crash (at least for me), but still operates on an
destroyed object, which is an even more subtle issue.
> Hm, I'll have to run the debugger a bit myself I think. :)
This is an interesting problem, if you find out anything please let me
know, I appreciate your help in getting to the bottom of this.
Thanks,
Carsten
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users