Hi Shayne,

It turned out that I was NOT using ref_ptr. I made the correction and it no
longer crashes...:).

Yeah, always store pointers to reference counted objects in ref_ptrs if you intend to keep a pointer to it around. The OSG examples create nodes and other objects as raw pointers, but they do so in an anonymous scope (between { ... } ) so that we're sure not to hold on to the raw pointer - the variable ceases to exist when the scope ends.

As I said, it's a common gotcha.

Just for reference, I bet if you had run your program in a debugger and put a breakpoint at the line before the crash occured, and then inspected the value of the program pointer, you would have seen it's garbage, which would have tipped you off that it was a memory / dangling pointer / reference counting problem.

Problems solved. THANK YOU!

Good to know. Glad to have been able to help,

J-S
--
______________________________________________________
Jean-Sebastien Guay    [EMAIL PROTECTED]
                               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