Depsgraph: immediately free object's derived caches in the COW step.
authorAlexander Gavrilov <angavrilov@gmail.com>
Mon, 3 Dec 2018 17:48:36 +0000 (20:48 +0300)
committerAlexander Gavrilov <angavrilov@gmail.com>
Mon, 3 Dec 2018 17:48:47 +0000 (20:48 +0300)
After update of the mesh some of that data is so broken that using
it would crash. To reduce the risk of crashes in case of dependency
cycles, clean it up immediately.

source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc

index 21ca1636880ad9d5c69eb015bb24d2f02195856e..98e1bf49c5d696b2c2d426bdaa2f7ece7cdb1613 100644 (file)
@@ -854,6 +854,9 @@ static void deg_restore_object_runtime(
                         * that datablock.
                         */
                        object->data = mesh_orig;
+
+                       /* After that, immediately free the invalidated caches. */
+                       BKE_object_free_derived_caches(object);
                }
                else {
                        Mesh *mesh_eval = object->runtime.mesh_eval;