diff --git a/modules/gui/src/python_shell/python_interpreter_worker.cc b/modules/gui/src/python_shell/python_interpreter_worker.cc index 47dbcfc9e27282c6ec3b3f0e06203fb87b87b0b8..68f38a247f0026555ee87ff9d12da4b41579c217 100644 --- a/modules/gui/src/python_shell/python_interpreter_worker.cc +++ b/modules/gui/src/python_shell/python_interpreter_worker.cc @@ -53,8 +53,12 @@ PythonInterpreterWorker::PythonInterpreterWorker(): PythonInterpreterWorker::~PythonInterpreterWorker() { - // we have to manually run the exit functions because we cannot use Py_Finalize due to some problems in boost python - run_command_(std::pair<unsigned int, QString>(0,"import atexit\natexit._run_exitfuncs()\n")); + // we have to manually run the exit functions because we cannot use + // Py_Finalize due to some problems in boost python. + run_command_(std::pair<unsigned int, QString>(0, + "import atexit\n" + "atexit._run_exitfuncs()\n")); + //Py_Finalize(); } void PythonInterpreterWorker::Wake() diff --git a/modules/io/pymod/export_pdb_io.cc b/modules/io/pymod/export_pdb_io.cc index 6fe425aa7fef010477b6a36e1bbe9db9f92971bf..237b2918c4e0188c1af301d212e073195266d87f 100644 --- a/modules/io/pymod/export_pdb_io.cc +++ b/modules/io/pymod/export_pdb_io.cc @@ -34,7 +34,7 @@ void (PDBWriter::*write_a)(const mol::EntityHandle&)=&PDBWriter::Write; void (PDBWriter::*write_b)(const mol::EntityView&)=&PDBWriter::Write; void remove_profiles() { - IOProfileRegistry::Instance().RemoveProfiles(); + IOProfileRegistry::RemoveProfiles(); } void export_pdb_io() diff --git a/modules/io/src/mol/io_profile.cc b/modules/io/src/mol/io_profile.cc index e48837e80bdae1322f715e87596c28291b6655d4..1d9f77fa0dbe2f91d4e3b125b3a2b45f5d2df657 100644 --- a/modules/io/src/mol/io_profile.cc +++ b/modules/io/src/mol/io_profile.cc @@ -2,6 +2,7 @@ namespace ost { namespace io { +bool IOProfileRegistry::alive = false; IOProfileRegistry& IOProfileRegistry::Instance() { static IOProfileRegistry reg; @@ -11,6 +12,7 @@ IOProfileRegistry& IOProfileRegistry::Instance() IOProfileRegistry::IOProfileRegistry(): profiles_() { + IOProfileRegistry::alive = true; profiles_["DEFAULT"]=IOProfile(); } diff --git a/modules/io/src/mol/io_profile.hh b/modules/io/src/mol/io_profile.hh index 188ed158bf1bddfe87869dc78f766a9233e730d6..4f14b35e31aa4fe501cd7abe04ae042aca2710ec 100644 --- a/modules/io/src/mol/io_profile.hh +++ b/modules/io/src/mol/io_profile.hh @@ -85,12 +85,18 @@ public: } IOProfile& GetDefault() { return profiles_["DEFAULT"]; } - void RemoveProfiles() { - profiles_.clear(); + static void RemoveProfiles() { + if (IOProfileRegistry::alive) { + IOProfileRegistry::Instance().profiles_.clear(); + } + } + ~IOProfileRegistry() { + alive = false; } private: IOProfileRegistry(); std::map<String, IOProfile> profiles_; + static bool alive; }; }}