[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19619] branches/blender2.5/blender/source /blender/editors/animation/keyframing.c: 2.5 Bugfix: Trying to insert/ delete keyframes on old-style buttons would crash

Joshua Leung aligorith at gmail.com
Thu Apr 9 13:36:12 CEST 2009


Revision: 19619
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19619
Author:   aligorith
Date:     2009-04-09 13:36:12 +0200 (Thu, 09 Apr 2009)

Log Message:
-----------
2.5 Bugfix: Trying to insert/delete keyframes on old-style buttons would crash

Fixed the problems with using uninitialised vars in the calls for inserting keyframes from buttons. Oldstyle buttons (i.e. those without any RNA links, such as the 3D-View header buttons) would crash otherwise.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/keyframing.c

Modified: branches/blender2.5/blender/source/blender/editors/animation/keyframing.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/keyframing.c	2009-04-09 10:29:07 UTC (rev 19618)
+++ branches/blender2.5/blender/source/blender/editors/animation/keyframing.c	2009-04-09 11:36:12 UTC (rev 19619)
@@ -2386,8 +2386,8 @@
 static int insert_key_button_exec (bContext *C, wmOperator *op)
 {
 	Scene *scene= CTX_data_scene(C);
-	PointerRNA ptr;
-	PropertyRNA *prop;
+	PointerRNA ptr = {0};
+	PropertyRNA *prop= NULL;
 	char *path;
 	float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
 	short success= 0;
@@ -2395,23 +2395,23 @@
 	
 	/* try to insert keyframe using property retrieved from UI */
 	uiAnimContextProperty(C, &ptr, &prop, &index);
-
+	
 	if(ptr.data && prop && RNA_property_animateable(ptr.data, prop)) {
 		path= RNA_path_from_ID_to_property(&ptr, prop);
-
+		
 		if(path) {
 			if(all) {
 				length= RNA_property_array_length(&ptr, prop);
-
+				
 				if(length) index= 0;
 				else length= 1;
 			}
 			else
 				length= 1;
-
+			
 			for(a=0; a<length; a++)
 				success+= insertkey(ptr.id.data, NULL, path, index+a, cfra, 0);
-
+			
 			MEM_freeN(path);
 		}
 	}
@@ -2449,8 +2449,8 @@
 static int delete_key_button_exec (bContext *C, wmOperator *op)
 {
 	Scene *scene= CTX_data_scene(C);
-	PointerRNA ptr;
-	PropertyRNA *prop;
+	PointerRNA ptr = {0};
+	PropertyRNA *prop= NULL;
 	char *path;
 	float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
 	short success= 0;
@@ -2461,20 +2461,20 @@
 
 	if(ptr.data && prop) {
 		path= RNA_path_from_ID_to_property(&ptr, prop);
-
+		
 		if(path) {
 			if(all) {
 				length= RNA_property_array_length(&ptr, prop);
-
+				
 				if(length) index= 0;
 				else length= 1;
 			}
 			else
 				length= 1;
-
+			
 			for(a=0; a<length; a++)
 				success+= deletekey(ptr.id.data, NULL, path, index+a, cfra, 0);
-
+			
 			MEM_freeN(path);
 		}
 	}





More information about the Bf-blender-cvs mailing list