I have discovered the takeObject method, and now I understand better why the
object is not deleted, But it doesn't explain my crash... :/

On Dec 11, 2007 2: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




-- 
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

Reply via email to