summaryrefslogtreecommitdiff
path: root/src/Fl_Menu_Button.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2019-06-27 16:04:30 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2019-06-27 16:04:03 +0200
commit42b8cb7bb8211117d2e4c0b64632458c6815e56b (patch)
tree1defbe64677b90296e7468244c313885dae86403 /src/Fl_Menu_Button.cxx
parent44b2b7126c121d425d0856a4528db8ae5721bbbf (diff)
Add method Fl_Menu_::menu_end() (STR 3523)
This method can be called after all menu modifications to make sure the menu() array is relocated (copied from the internal working area) to a private place owned by the Fl_Menu_ instance. menu_end() is now called in Fl_Menu_Button::popup() to make sure the menu array is in private storage. This fixes STR 3523 w/o user code changes. Calling menu_end() is in most cases optional. Todo: call menu_end() where useful (or necessary), e.g. in Fl_Choice, Fl_Menu_Bar, etc. ?
Diffstat (limited to 'src/Fl_Menu_Button.cxx')
-rw-r--r--src/Fl_Menu_Button.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Fl_Menu_Button.cxx b/src/Fl_Menu_Button.cxx
index 74bf62430..0a5099b2c 100644
--- a/src/Fl_Menu_Button.cxx
+++ b/src/Fl_Menu_Button.cxx
@@ -3,7 +3,7 @@
//
// Menu button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 1998-2019 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -46,8 +46,14 @@ void Fl_Menu_Button::draw() {
and if they pick one it sets value() and does the callback or
sets changed() as described above. The menu item is returned
or NULL if the user dismisses the menu.
+
+ \note Since FLTK 1.4.0 Fl_Menu_::menu_end() is called before the menu
+ pops up to make sure the menu array is located in private storage.
+
+ \see Fl_Menu_::menu_end()
*/
const Fl_Menu_Item* Fl_Menu_Button::popup() {
+ menu_end();
const Fl_Menu_Item* m;
pressed_menu_button_ = this;
redraw();