Fix Object bbox memleak in depsgraph code.

Caused by rBae2b677dcb5a70f5, Object.runtime has lot of weird specific
handlings in depsgraph...

For now modified `deg_backup_object_runtime()` and
`deg_restore_object_runtime()` to mimic previous behavior regarding
Object bbox (i.e. pass it around, instead of wiping it clean).

Reported in T61660.
This commit is contained in:
Bastien Montagne 2019-02-18 18:15:00 +01:00
parent 49c7b34547
commit 16a290bb6f
1 changed files with 4 additions and 0 deletions

View File

@ -815,6 +815,8 @@ static void deg_backup_object_runtime(
Mesh *mesh_eval = object->runtime.mesh_eval;
object_runtime_backup->runtime = object->runtime;
BKE_object_runtime_reset(object);
/* Keep bbox (for now at least...). */
object->runtime.bb = object_runtime_backup->runtime.bb;
/* Object update will override actual object->data to an evaluated version.
* Need to make sure we don't have data set to evaluated one before free
* anything. */
@ -831,8 +833,10 @@ static void deg_restore_object_runtime(
const ObjectRuntimeBackup *object_runtime_backup)
{
Mesh *mesh_orig = object->runtime.mesh_orig;
BoundBox *bb = object->runtime.bb;
object->runtime = object_runtime_backup->runtime;
object->runtime.mesh_orig = mesh_orig;
object->runtime.bb = bb;
if (object->type == OB_MESH && object->runtime.mesh_eval != NULL) {
if (object->id.recalc & ID_RECALC_GEOMETRY) {
/* If geometry is tagged for update it means, that part of