Hi Serge,

Creating objects with and storing them locally with a C pointer rather
than a ref_ptr<> is usually just fine if the pointer just lives in
local scope, but there are gotchas lurking if your do certain
operations.  Most places where a C pointer is used within the OSG code
base is because its fine to do in that context.  Problems typically
occur when you try to use a C pointer as global.

Your own intermittent crash is more likely to be something like a
thread sensitivity.  Is your app multi-thread?  In what ways?  What is
the nature of the database setup?

Robert.

On Dec 11, 2007 1:33 PM, Serge Lages <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am currently having a random crash with osgText, here is the context : I
> read some IVE files with texts inside, when loading the text it crashs into
> osgText::Text::setFont (Text.cpp line 119) because the variable "font" is a
> corrupted pointer (not setted to NULL, but typically a variable already
> deleted).
>
> My investigations bring me to osgText::readFontFile into the file Font.cpp.
> Line 110 we can see :
>
> osg::Object* object = osgDB::readObjectFile(foundFile, userOptions ?
> userOptions : localOptions.get());
>
>  I always thought that doing this may lead to a crash, and that we must do :
>
> osg::ref_ptr<osg::Object> object = osgDB::readObjectFile(foundFile,
> userOptions ? userOptions : localOptions.get());
>
> To be sure that readObjectFile will not delete the object by deleting its
> ReaderWriter::ReadResult.
> And line 117, the test object->referenceCount()==0 makes me also perplex, if
> the object's reference count is set to 0, shouldn't it be already deleted ?
>
> My crash is really a random one, but always in the same place, that's why I
> think that sometime the font object is deleted before being assigned to a
> ref_ptr into setFont.
>
> --
> Serge Lages
>  http://www.tharsis-software.com
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to