diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-12-25 14:43:26 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-12-25 14:43:26 +0400 |
commit | 122e2b4bfa0211676042ba8e02570d1dcd2fc40d (patch) | |
tree | 109eb665c67d559d9f5a815f358f9e4f553c65c1 /source/blender/blenkernel/intern/object.c | |
parent | ad0a3de3ce7f84486047b11343405072f0972107 (diff) |
Fix T37709: Memory corruption when freeing custom bone shape objects
Summary:
Issue was caused by access to pchan->custom object from channel free
function when freeing all objects from main. Order of objects free
is not defined and such an access might easily end up with access
to freed memory.
We don't need to do user counter stuff when freeing main, so added
an _ex functions with do_id_user flag which is used when freeing main.
We had the same issue with other datablocks, so now it should be
easier to support relevant user counter.
This issue was caused by the fix for T36391, so perhaps that's indeed
high time to do real user counter.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Maniphest Tasks: T37709
Differential Revision: https://developer.blender.org/D137
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 8657e3b0ebf..e480f1a6bf7 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -321,7 +321,7 @@ void BKE_object_free_derived_caches(Object *ob) } /* do not free object itself */ -void BKE_object_free(Object *ob) +void BKE_object_free_ex(Object *ob, bool do_id_user) { int a; @@ -364,7 +364,7 @@ void BKE_object_free(Object *ob) if (ob->defbase.first) BLI_freelistN(&ob->defbase); if (ob->pose) - BKE_pose_free(ob->pose); + BKE_pose_free_ex(ob->pose, do_id_user); if (ob->mpath) animviz_free_motionpath(ob->mpath); BKE_bproperty_free_list(&ob->prop); @@ -399,6 +399,11 @@ void BKE_object_free(Object *ob) } } +void BKE_object_free(Object *ob) +{ + BKE_object_free_ex(ob, true); +} + static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Object **obpoin) { Object *unlinkOb = userData; |