Own the SGReaderWriterOptions object
Prevents it being unintentionally freed during the read call, causing a crash depending on the OSG version (some versions take a kung-fu death grip)
This commit is contained in:
parent
162ba266d0
commit
6849311d49
1 changed files with 4 additions and 3 deletions
|
@ -60,6 +60,8 @@
|
||||||
|
|
||||||
static const char* LICENSE_URL_TEXT = "Licensed under the GNU GPL. See http://www.flightgear.org for more information";
|
static const char* LICENSE_URL_TEXT = "Licensed under the GNU GPL. See http://www.flightgear.org for more information";
|
||||||
|
|
||||||
|
using namespace simgear;
|
||||||
|
|
||||||
class SplashScreenUpdateCallback : public osg::NodeCallback {
|
class SplashScreenUpdateCallback : public osg::NodeCallback {
|
||||||
public:
|
public:
|
||||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||||
|
@ -87,10 +89,9 @@ void SplashScreen::createNodes()
|
||||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||||
_splashImage = osgDB::readImageFile(splashImage);
|
_splashImage = osgDB::readImageFile(splashImage);
|
||||||
#else
|
#else
|
||||||
auto staticOptions = simgear::SGReaderWriterOptions::copyOrCreate(osgDB::Registry::instance()->getOptions());
|
osg::ref_ptr<SGReaderWriterOptions> staticOptions = SGReaderWriterOptions::copyOrCreate(osgDB::Registry::instance()->getOptions());
|
||||||
staticOptions->setLoadOriginHint(simgear::SGReaderWriterOptions::LoadOriginHint::ORIGIN_SPLASH_SCREEN);
|
staticOptions->setLoadOriginHint(SGReaderWriterOptions::LoadOriginHint::ORIGIN_SPLASH_SCREEN);
|
||||||
_splashImage = osgDB::readRefImageFile(splashImage, staticOptions);
|
_splashImage = osgDB::readRefImageFile(splashImage, staticOptions);
|
||||||
// _splashImage = osgDB::readRefImageFile(selectSplashImage());
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!_splashImage){
|
if (!_splashImage){
|
||||||
|
|
Loading…
Reference in a new issue