Change python global init/shutdown order to be safe vs running contexts

* If a window (like the PythonShell) owned a context and only stopped it
  on destruction, it would be destructed after the global shutdown
  destroyed the interpreter.
This commit is contained in:
baldurk
2017-04-18 10:08:25 +01:00
parent c3505944bd
commit ab41f1ec6a
+9 -9
View File
@@ -159,19 +159,19 @@ int main(int argc, char *argv[])
GUIInvoke::init();
CaptureContext ctx(filename, remoteHost, remoteIdent, temp, config);
PythonContext::GlobalInit();
while(ctx.isRunning())
{
application.processEvents(QEventLoop::WaitForMoreEvents);
QCoreApplication::sendPostedEvents();
CaptureContext ctx(filename, remoteHost, remoteIdent, temp, config);
while(ctx.isRunning())
{
application.processEvents(QEventLoop::WaitForMoreEvents);
QCoreApplication::sendPostedEvents();
}
config.Save();
}
PythonContext::GlobalShutdown();
config.Save();
}
delete[] argv_mod;