http://bugs.winehq.org/show_bug.cgi?id=12171
Summary: adding popupmenu to itself, then using finditem causes stack overflow Product: Wine Version: 0.9.58. Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: user32 AssignedTo: wine-bugs@winehq.org ReportedBy: mark.dufour@gmail.com
The following code crashes WINE, but not Windows. It adds a popupmenu to the popupmenu itself, then calls MENU_FindItem via GetMenuState. MENU_FindItem keeps following the loop until it crashes with a stack overflow. Windows reacts a bit strangely, too, but does not crash. Messing around in MENU_FindItem allows WZebra (othello program, listed in the appdb) to start, but I was unable to figure out the correct solution. Not sure if WZebra accidentally creates a temporary loop, or that this is caused by some other regression. WZebra used to work great a long time ago.
/* sub menu */ hSubMenu = CreatePopupMenu(); InsertMenu(hSubMenu, -1, MF_BYPOSITION, 1234, "loop");
/* main menu */ hMenu = CreateMenu(); InsertMenu(hMenu, -1, MF_BYPOSITION | MF_POPUP, (UINT)hSubMenu, "&File");
/* add popupmenu to itself */ ModifyMenu(hSubMenu, 1234, MF_POPUP, (UINT)hSubMenu, "loop");
/* MENU_FindItem ends up in infinite recursion */ GetMenuState(hMenu, (UINT)hSubMenu, 0);