[Bf-blender-cvs] [411650f] master: Partial fix for T3817: BGE crashing when using LibNew.

Mitchell Stokes noreply at git.blender.org
Sun Feb 23 21:46:48 CET 2014


Commit: 411650f2faab16e9f4e6f0fdba27ff278d25e61a
Author: Mitchell Stokes
Date:   Sun Feb 23 12:44:33 2014 -0800
https://developer.blender.org/rB411650f2faab16e9f4e6f0fdba27ff278d25e61a

Partial fix for T3817: BGE crashing when using LibNew.

The BGE needs to use BKE_main_new() isntead of calloc for
allocating a Main struct since the threaded depsgraph changes.

===================================================================

M	source/gameengine/Ketsji/KX_PythonInit.cpp

===================================================================

diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 5d0c6a8..234d03a 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -130,6 +130,7 @@ extern "C" {
 #include "PHY_IPhysicsEnvironment.h"
 #include "BKE_main.h"
 #include "BKE_global.h"
+#include "BKE_library.h"
 #include "BLI_blenlib.h"
 #include "GPU_material.h"
 #include "MEM_guardedalloc.h"
@@ -752,7 +753,7 @@ static PyObject *gLibNew(PyObject *, PyObject *args)
 		return NULL;
 	}
 	
-	Main *maggie= (Main *)MEM_callocN( sizeof(Main), "BgeMain");
+	Main *maggie=BKE_main_new();
 	kx_scene->GetSceneConverter()->GetMainDynamic().push_back(maggie);
 	strncpy(maggie->name, path, sizeof(maggie->name)-1);




More information about the Bf-blender-cvs mailing list