DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2680
Version: 1.3-current


According to this thread in fltk.bugs:
<http://www.fltk.org/newsgroups.php?gfltk.bugs+Q%221.3.0+freezes+in+Fl_Menu_Item%22>
there is a potential bug in src/Fl_Menu.cxx that can cause an application
to freeze in a CPU-bound endless loop.

This "regression" (caused by unusual or illegal Fl_Menu_Item flags) has
been introduced in svn r8639 to fix an issue with menu shortcuts for
invisible menu items (STR #2613).

I found a potential fix (see attached file Fl_Menu.patch), but I'm not
sure whether this is correct or there may be a better solution. Anyway,
although this is a somewhat undefined case, I suggest that we fix this in
FLTK.

Manolo, since you did that particular change, I assume that you are more
familiar with this code, and I'd like to see your comment (or a better
solution).

Here's a simple test case: use this patch to add an invisible menu item to
the menu button in test/menubar.cxx, compile and run it, then click on the
menu button. The application goes into an endless loop...

--- test/menubar.cxx    (revision 8862)
+++ test/menubar.cxx    (working copy)
@@ -176,6 +176,7 @@
   {"&Charm",   FL_ALT+'c'},
   {"Truth",    FL_ALT+'t'},
   {"Beauty",   FL_ALT+'b'},
+  {0,0, 0, 0, FL_MENU_INVISIBLE},
   {0}
 };


Link: http://www.fltk.org/str.php?L2680
Version: 1.3-current
Index: src/Fl_Menu.cxx
===================================================================
--- src/Fl_Menu.cxx     (revision 8862)
+++ src/Fl_Menu.cxx     (working copy)
@@ -81,7 +81,7 @@
   if (!m->visible()) n++;
   while (n) {
     m = next_visible_or_not(m);
-    if (m->visible()) n--;
+    if (m->visible() || !m->text) n--;
   }
   return m;
 }
_______________________________________________
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to