Fixing the initglobals leak in the Blenderplayer (G.main reference was being reassign...
[blender.git] / source / gameengine / GamePlayer / ghost / GPG_ghost.cpp
index 75181b6c33023bdbd52aa0c2a902b0f51238a295..7a98c7e09b0c100b70af81dd1bf93d96e789d213 100644 (file)
@@ -62,7 +62,8 @@ extern "C"
 #include "BKE_global.h"        
 #include "BKE_icons.h" 
 #include "BKE_node.h"  
-#include "BKE_report.h"        
+#include "BKE_report.h"
+#include "BKE_library.h"
 #include "BLI_blenlib.h"
 #include "DNA_scene_types.h"
 #include "DNA_userdef_types.h"
@@ -404,6 +405,9 @@ int main(int argc, char** argv)
        
        initglobals();
 
+       // We load our own G.main, so free the one that initglobals() gives us
+       free_main(G.main);
+
        IMB_init();
 
        // Setup builtin font for BLF (mostly copied from creator.c, wm_init_exit.c and interface_style.c)