Skip to content

Commit e5ea0e6

Browse files
[[ Bug 13328 ]] Setting menuhistory crashes in 7.0, and send menuPick with garbage as second parameter
1 parent 1e07bc1 commit e5ea0e6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docs/notes/bugfix-13328.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Setting menuhistory with a stack panel sends invalid menuPick second parameter

engine/src/button.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4128,7 +4128,12 @@ void MCButton::setmenuhistory(int2 newline)
41284128
MCU_break_string(MCString(menustring, menusize), tabs, ntabs, hasunicode());
41294129
uint2 oldline = menuhistory;
41304130
setmenuhistoryprop(MCU_max(MCU_min(newline, ntabs), 1));
4131-
if (menuhistory != oldline && !(state & CS_MFOCUSED) && tabs != NULL)
4131+
4132+
// SN-2014-09-03: [[ Bug 13328 ]] menupick should no be sent if there is a
4133+
// menuname: the oldline belongs to the panel stack, and certainly doesn't match
4134+
// the menustring of this button. At least, it would set a bad label, at worst,
4135+
// it gives garbage (and crashes in 7.0)
4136+
if (menuname == NULL && menuhistory != oldline && !(state & CS_MFOCUSED) && tabs != NULL)
41324137
message_with_args(MCM_menu_pick, tabs[menuhistory - 1], tabs[oldline - 1]);
41334138
resetlabel();
41344139
if (!(getstyleint(flags) == F_MENU && menumode == WM_TOP_LEVEL) || !opened)

0 commit comments

Comments
 (0)