Revision: 16892
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16892
Author:   campbellbarton
Date:     2008-10-03 06:41:02 +0200 (Fri, 03 Oct 2008)

Log Message:
-----------
error with GameLogic.globalDict loading. It would replace the dictionary rather 
then updating it.
This meant the BGE would load in an old dictonary replacing the loaded dict, 
loosing settings.

was also missing a decref for marshal data

Modified Paths:
--------------
    trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp

Modified: trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp    2008-10-03 
03:29:34 UTC (rev 16891)
+++ trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp    2008-10-03 
04:41:02 UTC (rev 16892)
@@ -1505,10 +1505,17 @@
 
                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);


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to