Hi Robert,

Look back my last message where I emmit a possible scenario. It seems that
this scenario is happening because when it crashs, the main thread is into
the removeExpiredSubgraphs method.

And I am having the same problem with the readNodeFile call into
databasepager.cpp (line 604), it seems that between the moment where
takeNode is called and the pointer becomes "nude" and the moment where it is
assigned again to a ref_ptr my app can crash. It is again because of a
cache's clear at the same time into the main thread.

I have remplaced this call by :

ReaderWriter::ReadResult rr =
Registry::instance()->readNode(databaseRequest->_fileName,
databaseRequest->_loadOptions.get());

                    if (rr.success())
                    {
                        databaseRequest->_loadedModel = rr.getNode();
                    }

I am currently testing but it seems to not crash anymore.

Another possibility (which can also resolve the osgText crash), is to block
the access to removeExpiredSubgraphs during the nodes loadings (only when
_deleteRemovedSubgraphsInDatabaseThread is set to false).

On Dec 11, 2007 3:49 PM, Robert Osfield <[EMAIL PROTECTED]> wrote:

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



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