Hello, Werner.

If I read your "createObject" correctly, you appear to be returning a raw
pointer to an object that gets deleted within the function.  Using ref_ptr
in the local scope, but returning a raw pointer, results in the deletion of
the object when you leave the function, since the only live reference is
going out of scope.  I would recommend that you either: 1) use ref_ptr as
your return type, or 2) wait to use ref_ptr outside of "createObject".

Unfortunately, I can't offer any advice on your testing question, since I
use "always" Visual Studio to build and use OSG.

I hope this helps...

D.J.

On Wed, Jan 26, 2011 at 12:31 PM, Werner Modenbach <[email protected]> wrote:

> Dear community,
>
> Maybe someone of you can give me a hint.
> I'm running Windows 7 64 Bit and osg 2.8.3.
>
>
> I have a Qt application working with AdapterWidget.
> Al my scene works fine and is displayed the right way.
> After deleting my view (derived from AdapterWidget) and reinstantiation of
> the view again
> I have problems with sharedObjects. The same scene doesn't work any more.
>
> The following trivial sequence of code crashes the program:
>
> someSharedObject * createObject {
>    osg::ref_ptr<someSharedObject> obj1 = new someSharedObject;
>    return obj1.get();
> }
>
> osg::ref_ptr<someSharedObject> obj2;
> obj2 = createObject();  // crashing here
>
> After restarting the program in the console the message appears:
>
> Fault tolerant heap shim applied to current process. This is usually due to
> previous crashes.
>
>
>
> The only reason I can imagine is the existance of static variables
> beeing uninitialized in the second run. Is there any hint where to look for
> that?
> I'd like to avoid reading tons of code.
>
> Another question in the context of testing:
> I found the tool spyGlass for tracking GL-calls. Is there any way to build
> it without visual studio?
> Like configure;make;make install ?
> Or ist there any other recommended tool?
>
> Thanks for any hints.
>
> - Werner -
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to