[Bf-blender-cvs] [b16bf6c] master: Resolve memory leask with reports on initialization
Campbell Barton
noreply at git.blender.org
Wed Jun 18 07:50:12 CEST 2014
Commit: b16bf6c3d4204ba5399f9854f7888630e984fe59
Author: Campbell Barton
Date: Wed Jun 18 15:48:38 2014 +1000
https://developer.blender.org/rBb16bf6c3d4204ba5399f9854f7888630e984fe59
Resolve memory leask with reports on initialization
===================================================================
M source/blender/editors/util/ed_util.c
M source/blender/windowmanager/intern/wm_init_exit.c
===================================================================
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 2580836..178af8c 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -41,7 +41,9 @@
#include "DNA_scene_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_glutil.h"
@@ -82,6 +84,12 @@ void ED_editors_init(bContext *C)
Object *ob, *obact = (sce && sce->basact) ? sce->basact->object : NULL;
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
* e.g. linked objects we have to ensure that they are actually the
* active object in this scene. */
@@ -101,6 +109,8 @@ void ED_editors_init(bContext *C)
if (sce) {
ED_space_image_paint_update(wm, sce->toolsettings);
}
+
+ SWAP(int, reports->flag, reports_flag_prev);
}
/* frees all editmode stuff */
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 675eb5e..f1c0457 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -117,11 +117,17 @@
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)
{
- 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 */
More information about the Bf-blender-cvs
mailing list