[osg-users] Call to readNodeFile works in osg 1.2, segfaults in osg 2.0
Robert Osfield
robert.osfield at gmail.com
Wed Aug 15 07:59:02 PDT 2007
Hi Ian,
The plugins should produce e FILE_NOT_HANDLED in the case of trying to
load a file format that is not directly handled by the plugin, if it
isn't doing this then this is a bug. The question then turns to which
plugin is not correctly returning a FILE_NOT_HANDLED.
What plugins are loaded in memory when this error occurs? Use the env
OSG_NOTFIY_LEVEL=DEBUG to find out what plugins are being loaded.
This should also give you an idea which plugin is the culprit.
Robert.
On 8/15/07, zeilstra at gdls.com <zeilstra at gdls.com> wrote:
> I have been working on moving some code from osg 1.2 to 2.0. It has largely
> gone smoothly but there is an issue with a call to readNodeFile. In this
> particular case, the filename being passed to readNodeFile is the name of an
> image file, and so I expect the read to fail and return a null pointer. (I
> then test for this and conditionally try to read the same file as an image
> file. It's a hack but it lets me handle map images and topographic data
> with the same function.) However, when I compile this code against the osg
> 2.0 libraries, the result is a segmentation fault. I ran the program in gdb
> and was able to examine the stack, the relevant portion of which I have
> reproduced below.
>
> #0 in __dynamic_cast () from /usr/lib/libstdc++.so.6
> #1 in osgDB::ReaderWriter::ReadResult::getNode (this)
> at OpenSceneGraph/src/osgDB/ReaderWriter.cpp:22
> #2 in osgDB::ReaderWriter::ReadResult::validNode (this)
> at OpenSceneGraph/include/osgDB/ReaderWriter:158
> #3 in osgDB::Registry::ReadNodeFunctor::isValid (this,
> readResult)
> at OpenSceneGraph/src/osgDB/Registry.cpp:1280
> #4 in osgDB::Registry::read (this,
> readFunctor)
> at OpenSceneGraph/src/osgDB/Registry.cpp:1440
> #5 in osgDB::Registry::readImplementation (this,
> readFunctor, useObjectCache)
> at OpenSceneGraph/src/osgDB/Registry.cpp:1508
> #6 in osgDB::Registry::readNodeImplementation (this,
> fileName, options)
> at OpenSceneGraph/src/osgDB/Registry.cpp:1725
> #7 in osgDB::Registry::readNode (this,
> fileName, options)
> at OpenSceneGraph/include/osgDB/Registry:207
> #8 in osgDB::readNodeFile (filename, options)
> at OpenSceneGraph/src/osgDB/ReadFile.cpp:60
> #9 in osgDB::readNodeFile (filename)
> at OpenSceneGraph/include/osgDB/ReadFile:107
>
> In frame 1, I checked the fields of the ReadResult object, and noted that
> they were mostly uninitialized, except for _status:
>
> _status = osgDB::ReaderWriter::ReadResult::FILE_NOT_HANDLED
>
> I guess that the segfault comes from trying to dynamic_cast an invalid
> address. Is this an error in the osg code, or should I not be invoking
> readNodeFile on a non-model file?
>
> - Ian Zeilstra This is an e-mail from General Dynamics Land Systems. It is
> for the intended recipient only and may contain confidential and privileged
> information. No one else may read, print, store, copy, forward or act in
> reliance on it or its attachments. If you are not the intended recipient,
> please return this message to the sender and delete the message and any
> attachments from your computer. Your cooperation is appreciated.
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
More information about the osg-users
mailing list