commit before doing some hefty shapekey change, will break compilation
[blender-staging.git] / source / blender / windowmanager / intern / wm_init_exit.c
index b4328d12e81dd5b119fd73d36d73af19d60f1add..b24ad19649de376c93cd8cf1b3b9bdd53ef858de 100644 (file)
@@ -55,6 +55,7 @@
 #include "BKE_packedFile.h"
 
 #include "BLI_blenlib.h"
+#include "BLI_cellalloc.h"
 
 #include "RE_pipeline.h"               /* RE_ free stuff */
 
@@ -195,6 +196,7 @@ void WM_exit(bContext *C)
                }
        }
        wm_operatortype_free();
+       WM_menutype_free();
        
        /* all non-screen and non-space stuff editors did, like editmode */
        if(C)
@@ -213,7 +215,10 @@ void WM_exit(bContext *C)
        
        fastshade_free_render();        /* shaded view */
        ED_preview_free_dbase();        /* frees a Main dbase, before free_blender! */
-       wm_free_reports(C);                     /* before free_blender! - since the ListBases get freed there */
+
+       if(C && CTX_wm_manager(C))
+               wm_free_reports(C);                     /* before free_blender! - since the ListBases get freed there */
+               
        free_blender();                         /* blender.c, does entire library and spacetypes */
 //     free_matcopybuf();
        free_anim_copybuf();
@@ -275,11 +280,14 @@ void WM_exit(bContext *C)
        
        SYS_DeleteSystem(SYS_GetSystem());
 
-       if(MEM_get_memory_blocks_in_use()!=0) {
-               printf("Error Totblock: %d\n", MEM_get_memory_blocks_in_use());
+       if(MEM_get_memory_blocks_in_use()!=0 || BLI_cellalloc_get_totblock()!=0) {
+               printf("Error Totblock: %d\n", 
+                       BLI_cellalloc_get_totblock()+MEM_get_memory_blocks_in_use());
+               BLI_cellalloc_printleaks();
+               BLI_cellalloc_destroy();
                MEM_printmemlist();
        }
-//     delete_autosave();
+       wm_autosave_delete();
        
        printf("\nBlender quit\n");