mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
fix shutdown error
This commit is contained in:
parent
d6647e3a85
commit
a257cbbfba
@ -45,6 +45,8 @@ P3DPythonRun(const char *program_name, const char *archive_file,
|
||||
_read_thread_continue = false;
|
||||
_program_continue = true;
|
||||
_session_terminated = false;
|
||||
_taskMgr = NULL;
|
||||
|
||||
INIT_LOCK(_commands_lock);
|
||||
INIT_THREAD(_read_thread);
|
||||
|
||||
@ -116,7 +118,7 @@ P3DPythonRun(const char *program_name, const char *archive_file,
|
||||
////////////////////////////////////////////////////////////////////
|
||||
P3DPythonRun::
|
||||
~P3DPythonRun() {
|
||||
nassertv(_instances.empty());
|
||||
terminate_session();
|
||||
|
||||
// Close the write pipe, so the parent process will terminate us.
|
||||
_pipe_write.close();
|
||||
@ -1406,14 +1408,18 @@ terminate_session() {
|
||||
}
|
||||
_instances.clear();
|
||||
|
||||
PyObject *result = PyObject_CallMethod(_taskMgr, (char *)"stop", (char *)"");
|
||||
if (result == NULL) {
|
||||
PyErr_Print();
|
||||
return;
|
||||
if (!_session_terminated) {
|
||||
if (_taskMgr != NULL) {
|
||||
PyObject *result = PyObject_CallMethod(_taskMgr, (char *)"stop", (char *)"");
|
||||
if (result == NULL) {
|
||||
PyErr_Print();
|
||||
} else {
|
||||
Py_DECREF(result);
|
||||
}
|
||||
}
|
||||
|
||||
_session_terminated = true;
|
||||
}
|
||||
Py_DECREF(result);
|
||||
|
||||
_session_terminated = true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user