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

fix another segfault on exit

parent e35160d0
Branches
Tags
No related merge requests found
......@@ -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()
......
......@@ -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()
......
......@@ -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();
}
......
......@@ -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;
};
}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment