From 411650f2faab16e9f4e6f0fdba27ff278d25e61a Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sun, 23 Feb 2014 12:44:33 -0800 Subject: 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. --- source/gameengine/Ketsji/KX_PythonInit.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/gameengine/Ketsji/KX_PythonInit.cpp') diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 5d0c6a8bb83..234d03ab618 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); -- cgit v1.2.3