Am 31.05.2016 um 01:24 schrieb Julien Valentin:
> Hi all 
> This change introduce a crash during static_cast from osg::XXX to ive::XXX
> (to reproduce it simply try to output an image 
> osgDB::WriteImageFile(*im,"output.ive") )
> It seams removal of all pure virtual methods of the base class ReadWrite fix 
> the bug 
I can confirm that the crash is gone after removing the pure virtual
methods.
> (I assume removing multiple inheritance on all ive::XXX would be cleaner)
On the other side the ive implementation shows some issue related to
casting, which looks to be raised now,  for example:


void ive::DataOutputStream::writeNode(const osg::Node* node)
...
        else if(dynamic_cast<const osg::Geode*>(node)){
            ((ive::Geode*)(node))->write(this);
        }
-> is is assumed that if node is osg::Geode, it is also ive::Geode  [1]

        else if(dynamic_cast<const ive::Group*>(node)){
            ((ive::Group*)(node))->write(this);
        }

-> good
        else if(dynamic_cast<const osgSim::LightPointNode*>(node)){
            ((ive::LightPointNode*)(node))->write(this);
        }

-> cast checks for 'const osgSim::LightPointNode*' but casts to
ive::LightPointNode* may be same assumption a [1]


        else if(dynamic_cast<const osgSim::LightPointNode*>(node)){
            ((ive::LightPointNode*)(node))->write(this);
        }
        else
        {
            if (typeid(node)!=typeid(osg::Node))
            {
                OSG_WARN<<"Unknown node in Group::write(),
className()="<<node->className()<<std::endl;
            }

           ((ive::Node*)(node))->write(this);

-> node is surely no osg:Node and also having [1] in mind that osg::xx
matches ive::xx, this will crash

In the crash case node is of type osg::Group


Ralf

_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to