Revert "BGE: Fix T44557 GameLogic module memory leak."
This reverts commit cd24871706411b2afd6e098e2b7c95c94bc2de38. The commit re-introduced problems with starting the game engine multiple times in the same run of Blender.
This commit is contained in:
parent
3699ab1843
commit
77ce7eb541
@ -588,11 +588,22 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
|
||||
// inside the GameLogic dictionary when the python interpreter is finalized.
|
||||
// which allows the scene to safely delete them :)
|
||||
// see: (space.c)->start_game
|
||||
|
||||
PyDict_Clear(PyModule_GetDict(gameLogic));
|
||||
PyDict_SetItemString(PyModule_GetDict(gameLogic), "globalDict", pyGlobalDict);
|
||||
|
||||
//PyDict_Clear(PyModule_GetDict(gameLogic));
|
||||
|
||||
// Keep original items, means python plugins will autocomplete members
|
||||
PyObject *gameLogic_keys_new = PyDict_Keys(PyModule_GetDict(gameLogic));
|
||||
const Py_ssize_t numitems= PyList_GET_SIZE(gameLogic_keys_new);
|
||||
Py_ssize_t listIndex;
|
||||
for (listIndex=0; listIndex < numitems; listIndex++) {
|
||||
PyObject *item = PyList_GET_ITEM(gameLogic_keys_new, listIndex);
|
||||
if (!PySequence_Contains(gameLogic_keys, item)) {
|
||||
PyDict_DelItem( PyModule_GetDict(gameLogic), item);
|
||||
}
|
||||
}
|
||||
Py_DECREF(gameLogic_keys_new);
|
||||
gameLogic_keys_new = NULL;
|
||||
#endif
|
||||
|
||||
ketsjiengine->StopEngine();
|
||||
#ifdef WITH_PYTHON
|
||||
exitGamePythonScripting();
|
||||
|
Loading…
Reference in New Issue
Block a user