Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-10-28 17:47:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2014-10-28 17:47:51 +0300
commitee4fb233618c0842e216042f442fbbc4d000b0bb (patch)
treed6279f128855cf84d55f117cbfd55e76ca7b4eab /source/blender/windowmanager
parentcb7afe5e419c1219ec3e96c580225d4603089167 (diff)
WM: clear operator memory on file load
Was causing problems when opening scenes with different scale set.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h1
-rw-r--r--source/blender/windowmanager/intern/wm_files.c4
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c21
3 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index cf9f94aff25..a580260c5b0 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -230,6 +230,7 @@ void WM_operatortype_append_ptr(void (*opfunc)(struct wmOperatorType *, void *)
void WM_operatortype_append_macro_ptr(void (*opfunc)(struct wmOperatorType *, void *), void *userdata);
void WM_operatortype_remove_ptr(struct wmOperatorType *ot);
bool WM_operatortype_remove(const char *idname);
+void WM_operatortype_last_properties_clear_all(void);
struct wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *name, const char *description, int flag);
struct wmOperatorTypeMacro *WM_operatortype_macro_define(struct wmOperatorType *ot, const char *idname);
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 7865e09cbe2..8f0f76466e9 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -476,6 +476,8 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
BPY_python_reset(C);
#endif
+ WM_operatortype_last_properties_clear_all();
+
/* important to do before NULL'ing the context */
BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_VERSION_UPDATE);
BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST);
@@ -668,6 +670,8 @@ int wm_homefile_read(bContext *C, ReportList *reports, bool from_memory, const c
}
#endif
+ WM_operatortype_last_properties_clear_all();
+
/* important to do before NULL'ing the context */
BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_VERSION_UPDATE);
BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 77f6028dd06..154249a2294 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -494,6 +494,27 @@ bool WM_operatortype_remove(const char *idname)
return true;
}
+/**
+ * Remove memory of all previously executed tools.
+ */
+void WM_operatortype_last_properties_clear_all(void)
+{
+ GHashIterator iter;
+
+ for (WM_operatortype_iter(&iter);
+ (!BLI_ghashIterator_done(&iter));
+ (BLI_ghashIterator_step(&iter)))
+ {
+ wmOperatorType *ot = BLI_ghashIterator_getValue(&iter);
+
+ if (ot->last_properties) {
+ IDP_FreeProperty(ot->last_properties);
+ MEM_freeN(ot->last_properties);
+ ot->last_properties = NULL;
+ }
+ }
+}
+
/* SOME_OT_op -> some.op */
void WM_operator_py_idname(char *to, const char *from)
{