Revision: 39864
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39864
Author:   campbellbarton
Date:     2011-09-02 07:51:19 +0000 (Fri, 02 Sep 2011)
Log Message:
-----------
fix for keymap search, was using uninitialized memory when the keymaps operator 
couldn't be found.

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_wm.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_wm.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_wm.c       2011-09-02 
06:48:14 UTC (rev 39863)
+++ trunk/blender/source/blender/makesrna/intern/rna_wm.c       2011-09-02 
07:51:19 UTC (rev 39864)
@@ -680,20 +680,14 @@
 {
        wmKeyMapItem *kmi= ptr->data;
        wmOperatorType *ot= WM_operatortype_find(kmi->idname, 1);
-       
-       if (ot)
-               strcpy(value, ot->name);
+       strcpy(value, ot ? ot->name : kmi->idname);
 }
 
 static int rna_wmKeyMapItem_name_length(PointerRNA *ptr)
 {
        wmKeyMapItem *kmi= ptr->data;
        wmOperatorType *ot= WM_operatortype_find(kmi->idname, 1);
-       
-       if (ot)
-               return strlen(ot->name);
-       else
-               return 0;
+       return strlen(ot ? ot->name : kmi->idname);
 }
 
 static int rna_KeyMapItem_userdefined_get(PointerRNA *ptr)
@@ -1652,7 +1646,9 @@
        RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_idname_get", 
"rna_wmKeyMapItem_idname_length", "rna_wmKeyMapItem_idname_set");
        RNA_def_struct_name_property(srna, prop);
        RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-       
+
+       /* this is infact the operator name, but if the operator can't be found 
we
+        * fallback on the operator ID */
        prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Name", "Name of operator to call on 
input event");

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to