BGE: Fix T44557 GameLogic module memory leak.
This reverts commit 7a28ca4398
.
This commit is contained in:
parent
f4d8ce9781
commit
cd24871706
Notes:
blender-bot
2023-02-14 09:48:25 +01:00
Referenced by commit 77ce7eb541
, Revert "BGE: Fix T44557 GameLogic module memory leak."
Referenced by issue #44557, BGE leaves references in memory after quitting
|
@ -584,22 +584,11 @@ 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));
|
||||
|
||||
// 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;
|
||||
|
||||
PyDict_Clear(PyModule_GetDict(gameLogic));
|
||||
PyDict_SetItemString(PyModule_GetDict(gameLogic), "globalDict", pyGlobalDict);
|
||||
#endif
|
||||
|
||||
ketsjiengine->StopEngine();
|
||||
#ifdef WITH_PYTHON
|
||||
exitGamePythonScripting();
|
||||
|
|
Loading…
Reference in New Issue