mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -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;
|
_read_thread_continue = false;
|
||||||
_program_continue = true;
|
_program_continue = true;
|
||||||
_session_terminated = false;
|
_session_terminated = false;
|
||||||
|
_taskMgr = NULL;
|
||||||
|
|
||||||
INIT_LOCK(_commands_lock);
|
INIT_LOCK(_commands_lock);
|
||||||
INIT_THREAD(_read_thread);
|
INIT_THREAD(_read_thread);
|
||||||
|
|
||||||
@ -116,7 +118,7 @@ P3DPythonRun(const char *program_name, const char *archive_file,
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
P3DPythonRun::
|
P3DPythonRun::
|
||||||
~P3DPythonRun() {
|
~P3DPythonRun() {
|
||||||
nassertv(_instances.empty());
|
terminate_session();
|
||||||
|
|
||||||
// Close the write pipe, so the parent process will terminate us.
|
// Close the write pipe, so the parent process will terminate us.
|
||||||
_pipe_write.close();
|
_pipe_write.close();
|
||||||
@ -1406,14 +1408,18 @@ terminate_session() {
|
|||||||
}
|
}
|
||||||
_instances.clear();
|
_instances.clear();
|
||||||
|
|
||||||
PyObject *result = PyObject_CallMethod(_taskMgr, (char *)"stop", (char *)"");
|
if (!_session_terminated) {
|
||||||
if (result == NULL) {
|
if (_taskMgr != NULL) {
|
||||||
PyErr_Print();
|
PyObject *result = PyObject_CallMethod(_taskMgr, (char *)"stop", (char *)"");
|
||||||
return;
|
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