[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37115] trunk/blender/source/blender/ python/intern/bpy_props.c: disable python/ string enum duplication from last commit because the array of duplicated strings can be freed and the pointers to the strings referenced still , the problem with python freeing strings that RNA references remains.

Campbell Barton ideasman42 at gmail.com
Fri Jun 3 06:39:19 CEST 2011


Revision: 37115
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37115
Author:   campbellbarton
Date:     2011-06-03 04:39:18 +0000 (Fri, 03 Jun 2011)
Log Message:
-----------
disable python/string enum duplication from last commit because the array of duplicated strings can be freed and the pointers to the strings referenced still, the problem with python freeing strings that RNA references remains.

Modified Paths:
--------------
    trunk/blender/source/blender/python/intern/bpy_props.c

Modified: trunk/blender/source/blender/python/intern/bpy_props.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_props.c	2011-06-03 04:21:41 UTC (rev 37114)
+++ trunk/blender/source/blender/python/intern/bpy_props.c	2011-06-03 04:39:18 UTC (rev 37115)
@@ -642,6 +642,7 @@
 	Py_RETURN_NONE;
 }
 
+#if 0
 /* copies orig to buf, then sets orig to buf, returns copy length */
 static size_t strswapbufcpy(char *buf, const char **orig)
 {
@@ -652,6 +653,7 @@
 	while((*dst= *src)) { dst++; src++; i++; }
 	return i + 1; /* include '\0' */
 }
+#endif
 
 static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, int *defvalue, const short is_enum_flag)
 {
@@ -760,6 +762,10 @@
 		}
 	}
 
+	/* disabled duplicating strings because the array can still be freed and
+	 * the strings from it referenced, for now we can't support dynamically
+	 * created strings from python. */
+#if 0
 	/* this would all work perfectly _but_ the python strings may be freed
 	 * immediately after use, so we need to duplicate them, ugh.
 	 * annoying because it works most of the time without this. */
@@ -777,6 +783,7 @@
 		items=items_dup;
 	}
 	/* end string duplication */
+#endif
 
 	return items;
 }




More information about the Bf-blender-cvs mailing list