Resent because the mail client turns out to default to html.  Original
message follows.

---

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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to