Skip to content
Snippets Groups Projects
Commit ae5890e0 authored by Marco Biasini's avatar Marco Biasini
Browse files

fix another segfault on exit

parent 74c636ad
No related branches found
No related tags found
No related merge requests found
...@@ -53,8 +53,12 @@ PythonInterpreterWorker::PythonInterpreterWorker(): ...@@ -53,8 +53,12 @@ PythonInterpreterWorker::PythonInterpreterWorker():
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 // we have to manually run the exit functions because we cannot use
run_command_(std::pair<unsigned int, QString>(0,"import atexit\natexit._run_exitfuncs()\n")); // 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() void PythonInterpreterWorker::Wake()
......
...@@ -34,7 +34,7 @@ void (PDBWriter::*write_a)(const mol::EntityHandle&)=&PDBWriter::Write; ...@@ -34,7 +34,7 @@ void (PDBWriter::*write_a)(const mol::EntityHandle&)=&PDBWriter::Write;
void (PDBWriter::*write_b)(const mol::EntityView&)=&PDBWriter::Write; void (PDBWriter::*write_b)(const mol::EntityView&)=&PDBWriter::Write;
void remove_profiles() { void remove_profiles() {
IOProfileRegistry::Instance().RemoveProfiles(); IOProfileRegistry::RemoveProfiles();
} }
void export_pdb_io() void export_pdb_io()
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace ost { namespace io { namespace ost { namespace io {
bool IOProfileRegistry::alive = false;
IOProfileRegistry& IOProfileRegistry::Instance() IOProfileRegistry& IOProfileRegistry::Instance()
{ {
static IOProfileRegistry reg; static IOProfileRegistry reg;
...@@ -11,6 +12,7 @@ IOProfileRegistry& IOProfileRegistry::Instance() ...@@ -11,6 +12,7 @@ IOProfileRegistry& IOProfileRegistry::Instance()
IOProfileRegistry::IOProfileRegistry(): IOProfileRegistry::IOProfileRegistry():
profiles_() profiles_()
{ {
IOProfileRegistry::alive = true;
profiles_["DEFAULT"]=IOProfile(); profiles_["DEFAULT"]=IOProfile();
} }
......
...@@ -85,12 +85,18 @@ public: ...@@ -85,12 +85,18 @@ public:
} }
IOProfile& GetDefault() { return profiles_["DEFAULT"]; } IOProfile& GetDefault() { return profiles_["DEFAULT"]; }
void RemoveProfiles() { static void RemoveProfiles() {
profiles_.clear(); if (IOProfileRegistry::alive) {
IOProfileRegistry::Instance().profiles_.clear();
}
}
~IOProfileRegistry() {
alive = false;
} }
private: private:
IOProfileRegistry(); IOProfileRegistry();
std::map<String, IOProfile> profiles_; std::map<String, IOProfile> profiles_;
static bool alive;
}; };
}} }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment