Re: [osg-users] Problems with osg:: sharedObjects

2011-01-27 Thread Werner Modenbach
Ah ... It's so obvious! Decades of programming is no guarantee for error free code. Thanks!!! On Wed, 26 Jan 2011 13:39:55 -0500, Jean-Sébastien Guay wrote: 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

[osg-users] Problems with osg:: sharedObjects

2011-01-26 Thread Werner Modenbach
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

Re: [osg-users] Problems with osg:: sharedObjects

2011-01-26 Thread D.J. Caldwell
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

Re: [osg-users] Problems with osg:: sharedObjects

2011-01-26 Thread Jean-Sébastien Guay
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