Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2015-08-26 12:11:40 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2015-08-26 12:13:50 +0300
commit77ce7eb5418e4f0adc5b5d9ac6d67a610f636b59 (patch)
tree8a94f405056d8b5fc393a49d0f0b9c5d342a0cf2 /source/gameengine/BlenderRoutines
parent3699ab1843c399b784cb6327a6c888db81e9e6e0 (diff)
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.
Diffstat (limited to 'source/gameengine/BlenderRoutines')
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index 41011cdee38..91382669d5c 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();