From 924e8a92d117a7667c075451668df85fce9ebac0 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Mon, 17 Jul 2006 20:33:45 +0000 Subject: Fixed crash on mixed use of keyboard and mouse for Fl_Menu_Button (STR #1356) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5259 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 2 ++ src/Fl_Menu.cxx | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index ec9fd44bd..2552d9eec 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,7 @@ CHANGES IN FLTK 1.1.8 + - Fixed crash on mixed use of keyboard and mouse for + Fl_Menu_Button (STR #1356) - Fixed Fl_Window::visible() and shown() for OS X (STR #1341) - Fixed Fl_Window::copy_label() losing copy (STR #1332) diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx index afb1ade0d..3aee4efcb 100644 --- a/src/Fl_Menu.cxx +++ b/src/Fl_Menu.cxx @@ -533,6 +533,9 @@ static void setitem(int m, int n) { static int forward(int menu) { // go to next item in menu menu if possible menustate &pp = *p; + // Fl_Menu_Button can geberate menu=-1. This line fixes it and selectes the first item. + if (menu==-1) + menu = 0; menuwindow &m = *(pp.p[menu]); int item = (menu == pp.menu_number) ? pp.item_number : m.selected; while (++item < m.numitems) { -- cgit v1.2.3