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:
Diffstat (limited to 'source/gameengine/Ketsji/KX_PythonInit.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index fc836234e2b..53b141a9bfe 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -1505,10 +1505,17 @@ int loadGamePythonConfig(char *marshal_buffer, int marshal_length)
if (gameLogic) {
PyObject* pyGlobalDict = PyMarshal_ReadObjectFromString(marshal_buffer, marshal_length);
-
if (pyGlobalDict) {
- PyDict_SetItemString(PyModule_GetDict(gameLogic), "globalDict", pyGlobalDict); // Same as importing the module.
+ PyObject* pyGlobalDict_orig = PyDict_GetItemString(PyModule_GetDict(gameLogic), "globalDict"); // Same as importing the module.
+ if (pyGlobalDict_orig) {
+ PyDict_Clear(pyGlobalDict_orig);
+ PyDict_Update(pyGlobalDict_orig, pyGlobalDict);
+ } else {
+ /* this should not happen, but cant find the original globalDict, just assign it then */
+ PyDict_SetItemString(PyModule_GetDict(gameLogic), "globalDict", pyGlobalDict); // Same as importing the module.
+ }
Py_DECREF(gameLogic);
+ Py_DECREF(pyGlobalDict);
return 1;
} else {
Py_DECREF(gameLogic);