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.
This commit is contained in:
Mitchell Stokes
2014-02-23 12:44:33 -08:00
parent 8be628cf7f
commit 411650f2fa

View File

@@ -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);