Resolve memory leask with reports on initialization

This commit is contained in:
Campbell Barton 2014-06-18 15:48:38 +10:00
parent 24090ead01
commit b16bf6c3d4
2 changed files with 19 additions and 3 deletions

@ -41,7 +41,9 @@
#include "DNA_scene_types.h" #include "DNA_scene_types.h"
#include "DNA_packedFile_types.h" #include "DNA_packedFile_types.h"
#include "BLI_blenlib.h" #include "BLI_utildefines.h"
#include "BLI_string.h"
#include "BLI_path_util.h"
#include "BIF_gl.h" #include "BIF_gl.h"
#include "BIF_glutil.h" #include "BIF_glutil.h"
@ -82,6 +84,12 @@ void ED_editors_init(bContext *C)
Object *ob, *obact = (sce && sce->basact) ? sce->basact->object : NULL; Object *ob, *obact = (sce && sce->basact) ? sce->basact->object : NULL;
ID *data; ID *data;
/* This is called during initialization, so we don't want to store any reports */
ReportList *reports = CTX_wm_reports(C);
int reports_flag_prev = reports->flag &= ~RPT_STORE;
SWAP(int, reports->flag, reports_flag_prev);
/* toggle on modes for objects that were saved with these enabled. for /* toggle on modes for objects that were saved with these enabled. for
* e.g. linked objects we have to ensure that they are actually the * e.g. linked objects we have to ensure that they are actually the
* active object in this scene. */ * active object in this scene. */
@ -101,6 +109,8 @@ void ED_editors_init(bContext *C)
if (sce) { if (sce) {
ED_space_image_paint_update(wm, sce->toolsettings); ED_space_image_paint_update(wm, sce->toolsettings);
} }
SWAP(int, reports->flag, reports_flag_prev);
} }
/* frees all editmode stuff */ /* frees all editmode stuff */

@ -117,11 +117,17 @@
static void wm_init_reports(bContext *C) static void wm_init_reports(bContext *C)
{ {
BKE_reports_init(CTX_wm_reports(C), RPT_STORE); ReportList *reports = CTX_wm_reports(C);
BLI_assert(!reports || BLI_listbase_is_empty(&reports->list));
BKE_reports_init(reports, RPT_STORE);
} }
static void wm_free_reports(bContext *C) static void wm_free_reports(bContext *C)
{ {
BKE_reports_clear(CTX_wm_reports(C)); ReportList *reports = CTX_wm_reports(C);
BKE_reports_clear(reports);
} }
bool wm_start_with_console = false; /* used in creator.c */ bool wm_start_with_console = false; /* used in creator.c */