paranoid check that RNA string functions set the string, would have helped solve...
authorCampbell Barton <ideasman42@gmail.com>
Fri, 2 Sep 2011 10:43:51 +0000 (10:43 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 2 Sep 2011 10:43:51 +0000 (10:43 +0000)
disabled in release mode.

source/blender/makesrna/intern/rna_access.c

index 0d4e31cdaf25e38f2115fe0a293bd3c9019af329..ad79771416de75a9fe3e5d3b1fd99d2743b7124a 100644 (file)
@@ -2216,8 +2216,17 @@ char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fi
        else
                buf= MEM_mallocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
 
+#ifndef NDEBUG
+       /* safety check to ensure the string is actually set */
+       buf[length]= 255;
+#endif
+
        RNA_property_string_get(ptr, prop, buf);
 
+#ifndef NDEBUG
+       BLI_assert(buf[length] == '\0');
+#endif
+
        return buf;
 }