1
0
Fork 0
flightgear/src
Florent Rougon afe7d996af FGPUIMenuBar: fix bug when several menu entries have the same label
Before this commit, if several menu entries (possibly in different
menus) had the same label after translation and latin1-ization by
FGLocale::utf8toLatin1(), selecting one of them used to fire the
bindings associated to all such entries. This is because the bindings
used to be stored in an std::map whose keys were the
translated-and-latin1-ized labels.

This commit fixes the problem in the following way:
  - the std::map (_bindings) is turned into an std::forward_list;
  - each element of this std::forward_list references the bindings
    assigned to a menu entry;
  - in order to allow FGPUIMenuBar::fireItem() to find the bindings
    assigned to the menu entry that triggered it,
    FGPUIMenuBar::make_menu() calls puMenuBar::add_submenu() with an
    additional argument ("user data") that attaches to the puObject for
    each menu entry a pointer to the relevant element of _bindings.

Note: given how the menubar is created, an std::vector wouldn't be
appropriate for _bindings, because we need the pointers to its elements
to be stable when new elements are added to _bindings.

Reported by Wayne Bragg: https://sourceforge.net/p/flightgear/mailman/message/37682605/
2022-07-27 00:30:12 +02:00
..
Add-ons Typo in "Addon-config: don’t overwrite autosaved props" (ticket 2059) 2021-08-20 16:53:37 +02:00
AIModel AI Aircraft not taking off because TowerController signOff was not called. 2022-06-20 21:32:52 +02:00
Aircraft src/Aircraft/replay-internal.cxx: removed stray diagnostic in prev commit. 2022-02-19 12:41:21 +00:00
Airports Fix segfaults in AI code 2022-06-19 10:28:54 +02:00
ATC AI Aircraft not taking off because TowerController signOff was not called. 2022-06-20 21:32:52 +02:00
Autopilot FlightPlan: distuinguish routes from flight-plans 2022-01-15 22:23:38 +00:00
Canvas Fix Camera ownership for GUI-Manager 2022-03-11 12:50:08 +00:00
Cockpit Use helper method for OSGText alignment mapAlignment 2022-03-10 15:12:34 +01:00
EmbeddedResources CMake: make another object dependency explicit 2021-03-10 10:17:15 +00:00
Environment Use std::function for callbacks 2022-05-25 10:38:20 +01:00
FDM Ground-cache: throw on NaN inputs 2022-06-01 11:50:38 +01:00
GUI FGPUIMenuBar: fix bug when several menu entries have the same label 2022-07-27 00:30:12 +02:00
Include GUI: XML to Nasal bridge, to keep PUI dialogs working 2022-03-09 16:52:19 +00:00
Input FGButton: Make init()'s "module" parameter const 2022-07-13 23:46:23 +01:00
Instrumentation Mach number added to mode-S XPDR properties, exposed to MP (for ATC). 2022-07-26 10:30:14 +01:00
Main Launcher and startup support for TACANs 2022-05-31 10:18:16 +01:00
Model Marker pins 2022-01-27 08:47:48 +00:00
MultiPlayer Mach number added to mode-S XPDR properties, exposed to MP (for ATC). 2022-07-26 10:30:14 +01:00
Navaids Launcher and startup support for TACANs 2022-05-31 10:18:16 +01:00
Network [swift] Pass struct to updatePlanes() instead of multiple vectors 2022-04-06 07:53:51 +01:00
Radio 'using' statement are for source files, not header files 2022-01-15 01:48:01 -06:00
Scenery WS30: Add property controlling splitting water mesh 2022-02-01 16:48:54 +00:00
Scripting Use std::function for callbacks 2022-05-25 10:38:20 +01:00
Sound Expose the machwave active and offset properties 2022-04-29 15:08:10 +02:00
Systems 'using' statement are for source files, not header files 2022-01-15 01:48:01 -06:00
Time Use std::function for callbacks 2022-05-25 10:38:20 +01:00
Traffic Remove Sentry XML error suppression 2021-07-28 13:45:23 +01:00
Viewer src/Viewer/splash: VR splash screen 2022-07-12 22:38:53 +01:00
CMakeLists.txt Switch to using OBJECT library for main build 2021-03-08 16:59:14 +00:00