Commit: 77ce7eb5418e4f0adc5b5d9ac6d67a610f636b59 Author: Sybren A. Stüvel Date: Wed Aug 26 11:11:40 2015 +0200 Branches: master https://developer.blender.org/rB77ce7eb5418e4f0adc5b5d9ac6d67a610f636b59
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. =================================================================== M source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp =================================================================== diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 41011cd..9138266 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -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(); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs