bugfix [#24944] Crash on attempting to keyframe HSV color
authorCampbell Barton <ideasman42@gmail.com>
Sat, 27 Nov 2010 18:30:56 +0000 (18:30 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 27 Nov 2010 18:30:56 +0000 (18:30 +0000)
prevent eternal loop

source/blender/editors/interface/interface_handlers.c

index 9216e3f2a8314b5c4b86f2a57bee1cfbf899b7d1..22f1771923bf6a9b8a2978b01f1c7cd99cf3728f 100644 (file)
@@ -4938,17 +4938,16 @@ void ui_button_active_free(const bContext *C, uiBut *but)
 void uiContextActiveProperty(const bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index)
 {
        ARegion *ar= CTX_wm_region(C);
 void uiContextActiveProperty(const bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index)
 {
        ARegion *ar= CTX_wm_region(C);
-       uiBlock *block;
-       uiBut *but, *activebut;
 
        memset(ptr, 0, sizeof(*ptr));
        *prop= NULL;
        *index= 0;
 
        while(ar) {
 
        memset(ptr, 0, sizeof(*ptr));
        *prop= NULL;
        *index= 0;
 
        while(ar) {
+               uiBlock *block;
+               uiBut *but, *activebut= NULL;
+       
                /* find active button */
                /* find active button */
-               activebut= NULL;
-
                for(block=ar->uiblocks.first; block; block=block->next) {
                        for(but=block->buttons.first; but; but= but->next) {
                                if(but->active)
                for(block=ar->uiblocks.first; block; block=block->next) {
                        for(but=block->buttons.first; but; but= but->next) {
                                if(but->active)
@@ -4958,20 +4957,20 @@ void uiContextActiveProperty(const bContext *C, struct PointerRNA *ptr, struct P
                        }
                }
 
                        }
                }
 
-               if(activebut) {
-                       if(activebut->rnapoin.data) {
-                               uiHandleButtonData *data= activebut->active;
-                               
-                               /* found RNA button */
-                               *ptr= activebut->rnapoin;
-                               *prop= activebut->rnaprop;
-                               *index= activebut->rnaindex;
-                       
-                               /* recurse into opened menu, like colorpicker case */
-                               if(data && data->menu)
-                                       ar = data->menu->region;
-                               else
-                                       return;
+               if(activebut && activebut->rnapoin.data) {
+                       uiHandleButtonData *data= activebut->active;
+
+                       /* found RNA button */
+                       *ptr= activebut->rnapoin;
+                       *prop= activebut->rnaprop;
+                       *index= activebut->rnaindex;
+
+                       /* recurse into opened menu, like colorpicker case */
+                       if(data && data->menu && (ar != data->menu->region)) {
+                               ar = data->menu->region;
+                       }
+                       else {
+                               return;
                        }
                }
                else {
                        }
                }
                else {