[Bf-blender-cvs] [f2f1075] master: Fix T49168: crash when evaluating a cache constraint with a NULL cache file.
Kévin Dietrich
noreply at git.blender.org
Fri Aug 26 14:28:59 CEST 2016
Commit: f2f107572cc3c2061b535e46f6a0d3571c555957
Author: Kévin Dietrich
Date: Fri Aug 26 14:21:06 2016 +0200
Branches: master
https://developer.blender.org/rBf2f107572cc3c2061b535e46f6a0d3571c555957
Fix T49168: crash when evaluating a cache constraint with a NULL cache
file.
===================================================================
M source/blender/blenkernel/intern/constraint.c
===================================================================
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 70fdd4a..116c757 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -4353,11 +4353,15 @@ static void transformcache_evaluate(bConstraint *con, bConstraintOb *cob, ListBa
bTransformCacheConstraint *data = con->data;
Scene *scene = cob->scene;
- const float frame = BKE_scene_frame_get(scene);
- const float time = BKE_cachefile_time_offset(data->cache_file, frame, FPS);
-
CacheFile *cache_file = data->cache_file;
+ if (!cache_file) {
+ return;
+ }
+
+ const float frame = BKE_scene_frame_get(scene);
+ const float time = BKE_cachefile_time_offset(cache_file, frame, FPS);
+
BKE_cachefile_ensure_handle(G.main, cache_file);
ABC_get_transform(cache_file->handle, cob->ob, data->object_path,
@@ -4391,6 +4395,13 @@ static void transformcache_free(bConstraint *con)
}
}
+static void transformcache_new_data(void *cdata)
+{
+ bTransformCacheConstraint *data = (bTransformCacheConstraint *)cdata;
+
+ data->cache_file = NULL;
+}
+
static bConstraintTypeInfo CTI_TRANSFORM_CACHE = {
CONSTRAINT_TYPE_TRANSFORM_CACHE, /* type */
sizeof(bTransformCacheConstraint), /* size */
@@ -4399,7 +4410,7 @@ static bConstraintTypeInfo CTI_TRANSFORM_CACHE = {
transformcache_free, /* free data */
transformcache_id_looper, /* id looper */
transformcache_copy, /* copy data */
- NULL, /* new data */
+ transformcache_new_data, /* new data */
NULL, /* get constraint targets */
NULL, /* flush constraint targets */
NULL, /* get target matrix */
More information about the Bf-blender-cvs
mailing list