OSG < 3.4.x fixes
This will use the inherently unsafe versions of the load methods which can result in deleting an object (from the cache) that has just been loaded in the database thread. Symptom OSG WARN deleting still referenced object. branches next, origin/next
This commit is contained in:
parent
7ab07eb1c0
commit
f05c0297c0
5 changed files with 34 additions and 2 deletions
|
@ -84,7 +84,11 @@ namespace canvas
|
|||
{
|
||||
SGPath valid_path = fgValidatePath(p, false);
|
||||
if( !valid_path.isNull() )
|
||||
return osgDB::readRefImageFile(valid_path.local8BitStr());
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
return osgDB::readRefImageFile(valid_path.local8BitStr());
|
||||
#else
|
||||
return osgDB::readRefImageFile(valid_path.local8BitStr());
|
||||
#endif
|
||||
|
||||
SG_LOG(SG_IO, SG_ALERT, "canvas::Image: reading '" << path << "' denied");
|
||||
}
|
||||
|
@ -92,7 +96,11 @@ namespace canvas
|
|||
{
|
||||
SGPath tpath = globals->resolve_resource_path(path);
|
||||
if( !tpath.isNull() )
|
||||
return osgDB::readRefImageFile(tpath.local8BitStr());
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
return osgDB::readImageFile(tpath.local8BitStr());
|
||||
#else
|
||||
return osgDB::readRefImageFile(tpath.local8BitStr());
|
||||
#endif
|
||||
|
||||
SG_LOG(SG_IO, SG_ALERT, "canvas::Image: No such image: '" << path << "'");
|
||||
}
|
||||
|
|
|
@ -117,7 +117,11 @@ void FGPgtTerrain::init( osg::Group* terrain ) {
|
|||
options->setDem(_dem);
|
||||
|
||||
SG_LOG(SG_TERRAIN, SG_INFO, "Terrain init - Load w180s90-360x180.pgt" );
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile("w180s90-360x180.pgt", options.get());
|
||||
#else
|
||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFile("w180s90-360x180.pgt", options.get());
|
||||
#endif
|
||||
if ( loadedModel ) {
|
||||
terrain_branch->addChild( loadedModel.get() );
|
||||
|
||||
|
|
|
@ -81,7 +81,11 @@ SplashScreen::~SplashScreen()
|
|||
|
||||
void SplashScreen::createNodes()
|
||||
{
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
_splashImage = osgDB::readImageFile(selectSplashImage());
|
||||
#else
|
||||
_splashImage = osgDB::readRefImageFile(selectSplashImage());
|
||||
#endif
|
||||
|
||||
int width = _splashImage->s();
|
||||
int height = _splashImage->t();
|
||||
|
@ -281,7 +285,11 @@ void SplashScreen::setupLogoImage()
|
|||
return;
|
||||
}
|
||||
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
_logoImage = osgDB::readImageFile(logoPath.utf8Str());
|
||||
#else
|
||||
_logoImage = osgDB::readRefImageFile(logoPath.utf8Str());
|
||||
#endif
|
||||
if (!_logoImage) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -552,8 +552,12 @@ Viewer::insertSceneData(const std::string& fileName, const osgDB::Options* optio
|
|||
proxyNode->setFileName(0, fileName);
|
||||
insertSceneData(proxyNode);
|
||||
return true;
|
||||
#else
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(fileName, options);
|
||||
#else
|
||||
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFile(fileName, options);
|
||||
#endif
|
||||
if (!node.valid())
|
||||
return false;
|
||||
insertSceneData(node.get());
|
||||
|
|
|
@ -253,11 +253,19 @@ main(int argc, char** argv)
|
|||
osg::ref_ptr<osg::Node> loadedModel;
|
||||
if (1 < arguments.argc()) {
|
||||
// read the scene from the list of file specified command line args.
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
loadedModel = osgDB::readNodeFiles(arguments, options.get());
|
||||
#else
|
||||
loadedModel = osgDB::readRefNodeFiles(arguments, options.get());
|
||||
#endif
|
||||
} else {
|
||||
// if no arguments given resort to the whole world scenery
|
||||
options->setPluginStringData("SimGear::FG_EARTH", "ON");
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
loadedModel = osgDB::readNodeFile("w180s90-360x180.spt", options.get());
|
||||
#else
|
||||
loadedModel = osgDB::readRefNodeFile("w180s90-360x180.spt", options.get());
|
||||
#endif
|
||||
}
|
||||
|
||||
// if no model has been successfully loaded report failure.
|
||||
|
|
Loading…
Add table
Reference in a new issue