- was freeing reports on freed listbases
authorCampbell Barton <ideasman42@gmail.com>
Sun, 19 Jul 2009 04:50:10 +0000 (04:50 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 19 Jul 2009 04:50:10 +0000 (04:50 +0000)
- free reports in a single loop.
- extrude was using a NULL scene, crashed when used as a macro

source/blender/blenkernel/intern/report.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/windowmanager/intern/wm_init_exit.c

index 3e3dd4b0af0251904a7c9c27f728d24484600aac..391adfb762ac19fa57c7927861aa793d1d610bfe 100644 (file)
@@ -73,15 +73,21 @@ void BKE_reports_init(ReportList *reports, int flag)
 
 void BKE_reports_clear(ReportList *reports)
 {
-       Report *report;
+       Report *report, *report_next;
 
        if(!reports)
                return;
 
-       for(report=reports->list.first; report; report=report->next)
+       report= reports->list.first;
+
+       while (report) {
+               report_next= report->next;
                MEM_freeN(report->message);
+               MEM_freeN(report);
+               report= report_next;
+       }
 
-       BLI_freelistN(&reports->list);
+       reports->list.first= reports->list.last= NULL;
 }
 
 void BKE_report(ReportList *reports, ReportType type, const char *message)
index e16adf8ab2e6f5190b16d479f07e26cd9ece174f..3c186659adc2ba5d4fc825b5a3c970f82413a660 100644 (file)
@@ -622,9 +622,8 @@ void hashvert_flag(EditMesh *em, int flag)
 }
 
 /* generic extern called extruder */
-void extrude_mesh(Object *obedit, EditMesh *em, wmOperator *op)
+void extrude_mesh(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op)
 {
-       Scene *scene= NULL;             // XXX CTX!
        float nor[3]= {0.0, 0.0, 0.0};
        short nr, transmode= 0;
 
@@ -704,7 +703,7 @@ static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        int constraint_axis[3] = {0, 0, 1};
 
-       extrude_mesh(obedit,em, op);
+       extrude_mesh(scene, obedit, em, op);
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
@@ -731,7 +730,7 @@ static int mesh_extrude_exec(bContext *C, wmOperator *op)
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
 
-       extrude_mesh(obedit,em, op);
+       extrude_mesh(scene, obedit, em, op);
 
        DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
index 94218c10c9a2cf10ab180a463345605830b06113..5c34b19c1f41d79f1f570ce8a31e87d440bb57cc 100644 (file)
@@ -227,6 +227,7 @@ 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 */
        free_blender();                         /* blender.c, does entire library and spacetypes */
 //     free_matcopybuf();
        free_anim_copybuf();
@@ -270,8 +271,6 @@ void WM_exit(bContext *C)
 
        RNA_exit();
        
-       wm_free_reports(C);
-       
        CTX_free(C);
        
        if(MEM_get_memory_blocks_in_use()!=0) {