[Bf-blender-cvs] [209dc07] depsgraph_refactor: Fix for memory leaks and potential segfaults with invalid drivers
Joshua Leung
noreply at git.blender.org
Fri Dec 5 05:22:10 CET 2014
Commit: 209dc07770b86717d8338e88684332d4facfa2e0
Author: Joshua Leung
Date: Fri Dec 5 17:06:04 2014 +1300
Branches: depsgraph_refactor
https://developer.blender.org/rB209dc07770b86717d8338e88684332d4facfa2e0
Fix for memory leaks and potential segfaults with invalid drivers
===================================================================
M source/blender/depsgraph/intern/depsgraph_build_relations.cpp
===================================================================
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
index e314a73..593a4e2 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -546,15 +546,27 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcurve)
/* driver -> data components (for interleaved evaluation - bones/constraints/modifiers) */
// XXX: this probably shouldn't be inlined here like this...
- if (strstr(fcurve->rna_path, "pose.bones[\"") != NULL) {
+ if (strstr(fcurve->rna_path, "pose.bones[") != NULL) {
/* interleaved drivers during bone eval */
- char *bone_name = BLI_str_quoted_substrN(fcurve->rna_path, "pose.bones[");
-
Object *ob = (Object *)id;
- bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
+ bPoseChannel *pchan;
+ char *bone_name;
+
+ bone_name = BLI_str_quoted_substrN(fcurve->rna_path, "pose.bones[");
+ pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
+
+ if (bone_name) {
+ MEM_freeN(bone_name);
+ bone_name = NULL;
+ }
- ComponentKey bone_key(id, DEPSNODE_TYPE_BONE, pchan->name);
- add_relation(driver_key, bone_key, DEPSREL_TYPE_DRIVER, "[Driver -> SubData] DepsRel");
+ if (pchan) {
+ ComponentKey bone_key(id, DEPSNODE_TYPE_BONE, pchan->name);
+ add_relation(driver_key, bone_key, DEPSREL_TYPE_DRIVER, "[Driver -> SubData] DepsRel");
+ }
+ else {
+ printf("Couldn't find bone name for driver path - '%s'\n", fcurve->rna_path);
+ }
}
else {
if (GS(id->name) == ID_OB) {
More information about the Bf-blender-cvs
mailing list