diff options
-rw-r--r-- | src/engine/Engine.cpp | 10 | ||||
-rw-r--r-- | src/module/World.cpp | 5 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp index a17a58c0..5fdee74a 100644 --- a/src/engine/Engine.cpp +++ b/src/engine/Engine.cpp @@ -83,11 +83,11 @@ Engine::~Engine() { deactivate(); - for (EngineStore::iterator i = engine_store()->begin(); - i != engine_store()->end(); ++i) { - if ( ! PtrCast<GraphObjectImpl>(i->second)->parent() ) - i->second.reset(); - } + SharedPtr<EngineStore> store = engine_store(); + if (store) + for (EngineStore::iterator i = store->begin(); i != store->end(); ++i) + if ( ! PtrCast<GraphObjectImpl>(i->second)->parent() ) + i->second.reset(); delete _broadcaster; delete _node_factory; diff --git a/src/module/World.cpp b/src/module/World.cpp index 727e2dc8..bfdcb7e8 100644 --- a/src/module/World.cpp +++ b/src/module/World.cpp @@ -77,6 +77,9 @@ load_module(const string& name) Shared::module_path(name), Glib::MODULE_BIND_LAZY); + // FIXME: SEGV on exit without this + module->make_resident(); + if (*module) { LOG(info) << "Loaded `" << name << "' from " << INGEN_MODULE_DIR << endl; return SharedPtr<Glib::Module>(module); @@ -129,6 +132,8 @@ struct WorldImpl : public boost::noncopyable { virtual ~WorldImpl() { + local_engine.reset(); + modules.clear(); interface_factories.clear(); script_runners.clear(); |