- ensure active material are cached
- clear osgDB object cache on exit explicitly
// pass the loaded scene graph to the viewer.
viewer.setSceneData(loadedModel.get());
- return viewer.run();
+ int result = viewer.run();
+
+ // clear cache now, since it contains SimGear objects. Otherwise SG_LOG
+ // calls during shutdown will cause crashes.
+ osgDB::Registry::instance()->clearObjectCache();
+
+ return result;
}
SG_LOG(SG_GENERAL, SG_ALERT, "Problems loading FlightGear materials.\n"
<< "Probably FG_ROOT is not properly set.");
}
+ ml->refreshActiveMaterials();
simgear::SGModelLib::init(fg_root, props);
// Set up the reader/writer options