- cmake macro list_insert_after/list_insert_before now error when the item passed...
authorCampbell Barton <ideasman42@gmail.com>
Thu, 13 Sep 2012 01:52:58 +0000 (01:52 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 13 Sep 2012 01:52:58 +0000 (01:52 +0000)
- BKE_pose_copy_data() check for target pointer is no longer valid and infact comparing against un-initialized memory in some cases.

build_files/cmake/macros.cmake
source/blender/blenkernel/intern/action.c

index 97ce84142e98965e92cae1ea361edd9f33c71506..317fcf0f120411d0b999428387f2623ab6923407 100644 (file)
@@ -27,7 +27,10 @@ macro(list_insert_after
        list_id item_check item_add
        )
        set(_index)
-       list(FIND ${list_id} "${item_check}" _index)
+       list(FIND "${list_id}" "${item_check}" _index)
+       if("${_index}" MATCHES "-1")
+               message(FATAL_ERROR "'${list_id}' doesn't contain '${item_check}'")
+       endif()
        math(EXPR _index "${_index} + 1")
        list(INSERT ${list_id} "${_index}" ${item_add})
        unset(_index)
@@ -37,7 +40,10 @@ macro(list_insert_before
        list_id item_check item_add
        )
        set(_index)
-       list(FIND ${list_id} "${item_check}" _index)
+       list(FIND "${list_id}" "${item_check}" _index)
+       if("${_index}" MATCHES "-1")
+               message(FATAL_ERROR "'${list_id}' doesn't contain '${item_check}'")
+       endif()
        list(INSERT ${list_id} "${_index}" ${item_add})
        unset(_index)
 endmacro()
index 3e5dff74f3b72283b28c5d5c2055e2f41d5cd818..06bf5211abb921c1cf3f733990518bac2601c83d 100644 (file)
@@ -526,18 +526,12 @@ void BKE_pose_copy_data(bPose **dst, bPose *src, int copycon)
        bPose *outPose;
        bPoseChannel *pchan;
        ListBase listb;
-       
+
        if (!src) {
                *dst = NULL;
                return;
        }
        
-       if (*dst == src) {
-               printf("BKE_pose_copy_data source and target are the same\n");
-               *dst = NULL;
-               return;
-       }
-       
        outPose = MEM_callocN(sizeof(bPose), "pose");
        
        BLI_duplicatelist(&outPose->chanbase, &src->chanbase);