diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-06-08 15:36:26 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-06-08 15:38:01 +0300 |
commit | ae3e59fb6181cf1e2ca0788dbec638270aac6c23 (patch) | |
tree | 1dc86d47e67ff27f9dc87bb2ce87753c5bdc5cd4 /source/blender/editors/sculpt_paint/sculpt.c | |
parent | aff6cc9cf107e1ca0cde3044075cc35dd1516a02 (diff) |
Fix T55380: Crash when getting out of EditMode in some cases
Derived meshes are to be dead, so soon this code will be removed as well.
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index ad8ed59ff5c..70a8c725284 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -5665,6 +5665,15 @@ void ED_object_sculptmode_enter_ex( BKE_sculptsession_free(ob); } + /* Make sure derived final from original object does not reference possibly + * freed memory. + */ + if (ob->derivedFinal != NULL) { + ob->derivedFinal->needsFree = true; + ob->derivedFinal->release(ob->derivedFinal); + ob->derivedFinal = NULL; + } + sculpt_init_session(depsgraph, scene, ob); /* Mask layer is required */ |