diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-11-10 17:56:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-11-10 18:05:13 +0300 |
commit | 3b38fd6bf92cd9abc502346198e54191a247e860 (patch) | |
tree | 6eaea96d6c3968a04f2cc87464b28a062d6728b1 /source | |
parent | 0024306362fcf8c6902366c131fc046a0da165bd (diff) |
Fix T46720: Crash applying subsurf modifier
Freeing a modifier that had data in the derived mesh could crash
(applying or removing).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 3 | ||||
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 1e345605ec2..5d5bfd9aafb 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -211,6 +211,9 @@ void BKE_object_free_modifiers(Object *ob) /* same for softbody */ BKE_object_free_softbody(ob); + + /* modifiers may have stored data in the DM cache */ + BKE_object_free_derived_caches(ob); } void BKE_object_modifier_hook_reset(Object *ob, HookModifierData *hmd) diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 8ef2bd1b2af..b7d1d6b817a 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -324,6 +324,7 @@ static bool object_modifier_remove(Main *bmain, Object *ob, ModifierData *md, BLI_remlink(&ob->modifiers, md); modifier_free(md); + BKE_object_free_derived_caches(ob); return 1; } @@ -709,6 +710,8 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi BLI_remlink(&ob->modifiers, md); modifier_free(md); + BKE_object_free_derived_caches(ob); + return 1; } |