[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43352] trunk/blender/source/blender/ python/intern/bpy_rna.c: fix for error comparing py-struct members

Campbell Barton ideasman42 at gmail.com
Fri Jan 13 12:36:38 CET 2012


Revision: 43352
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43352
Author:   campbellbarton
Date:     2012-01-13 11:36:32 +0000 (Fri, 13 Jan 2012)
Log Message:
-----------
fix for error comparing py-struct members

if 2 pyrna structs used the same pointer they could incorrectly compare as true, this caused an error in theme saving because an item could match its parent and stop writing (to prevent recursive writing of same data).

eg:
  context.user_preferences.themes[0].user_interface.wcol_regular == context.user_preferences.themes[0].user_interface

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

Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c	2012-01-13 10:14:48 UTC (rev 43351)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c	2012-01-13 11:36:32 UTC (rev 43352)
@@ -745,7 +745,7 @@
 
 static int pyrna_struct_compare(BPy_StructRNA *a, BPy_StructRNA *b)
 {
-	return (a->ptr.data == b->ptr.data) ? 0 : -1;
+	return (a->ptr.data == b->ptr.data && a->ptr.type == b->ptr.type) ? 0 : -1;
 }
 
 static int pyrna_prop_compare(BPy_PropertyRNA *a, BPy_PropertyRNA *b)




More information about the Bf-blender-cvs mailing list