Hello Werner, D.J.,

I would recommend that you either: 1)
use ref_ptr as your return type, or 2) wait to use ref_ptr outside of
"createObject".

Or return obj1.release() instead of obj1.get().

This tells the ref_ptr to decrease its ref count, but not delete the object if it gets to 0 (contrary to get()). Which is what will happen in your case (check with a debugger).

Incidentally, using a debugger would also have told you why it crashes... checking the pointer after the call to your function would have shown you that it had been deleted.

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to