Hi Ralf, I have recreated the crash using writeImageFile() and it very much looks like an issue with the hack that the ive plugin uses to get access to the custom read/write methods. This hack will only ever work if we don't modify the virtual table required to access the custom methods, hence the virtual methods in the base class are wrong. In fact the whole existence of the base class is misleading.
Removing the pure virtual methods from the base class fixes the crash for me so this is what I'll check in for now. I have also just removed the ReadWrite class completely and everything builds and runs correctly, including the writeImageFile() test you suggested. Once I have done more testing I'll check this in. Robert. On 31 May 2016 at 08:27, Ralf Habacker <[email protected]> wrote: > 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 _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
