Bugfix #25243
authorTon Roosendaal <ton@blender.org>
Wed, 15 Dec 2010 19:10:42 +0000 (19:10 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 15 Dec 2010 19:10:42 +0000 (19:10 +0000)
Pressing Enter twice on enum-menus or pulldowns sent an 'OK execute'
with illegal values (no menu item active). Caused crashes too.

source/blender/editors/interface/interface_handlers.c

index 77782e56f2319a4d9ea6eead21c49f3da0a31194..d66f7d262a915c8ef8563ce580e353dc6418df9c 100644 (file)
@@ -5726,10 +5726,10 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu,
                                menu->menuretval= UI_RETURN_CANCEL;
                        }
                        else if(ELEM(event->type, RETKEY, PADENTER) && event->val==KM_PRESS) {
-                               /* enter will always close this block, but we let the event
-                                * get handled by the button if it is activated */
+                               /* enter will always close this block, we let the event
+                                * get handled by the button if it is activated, otherwise we cancel */
                                if(!ui_but_find_activated(ar))
-                                       menu->menuretval= UI_RETURN_OK;
+                                       menu->menuretval= UI_RETURN_CANCEL;
                        }
                        else {
                                ui_mouse_motion_towards_check(block, menu, mx, my);