Fix T46720: Crash applying subsurf modifier
Freeing a modifier that had data in the derived mesh could crash (applying or removing).
This commit is contained in:
parent
0024306362
commit
3b38fd6bf9
Notes:
blender-bot
2023-02-14 08:27:36 +01:00
Referenced by issue #46720, Crash while entering edit mode if the object has subsurf and is child of another object with a bool modifier
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue