Skip to content

Commit dbf3dc5

Browse files
[[ BUg 12998 ]] Fix action-less menus items
1 parent 7c9b16c commit dbf3dc5

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

engine/src/desktop-menu.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,19 +317,20 @@ class MCMenuBuilderCallback: public IParseMenuCallback
317317
MCStringRef t_tag;
318318
// SN-2014-07-29: [[ Bug 12998 ]] We want to check if the has_tag member, not if the menu item
319319
// contains a tag (which is always true)
320+
t_tag = MCValueRetain(p_menuitem -> tag);
320321
if (!p_menuitem -> has_tag)
321322
{
323+
MCAutoStringRef t_replacement;
322324
if (t_action == kMCPlatformMenuItemActionAbout)
323-
/* UNCHECKED */ MCStringCreateWithCString("About", t_tag);
325+
/* UNCHECKED */ MCStringCreateWithCString("About", &t_replacement);
324326
else if (t_action == kMCPlatformMenuItemActionQuit)
325-
/* UNCHECKED */ MCStringCreateWithCString("Quit", t_tag);
327+
/* UNCHECKED */ MCStringCreateWithCString("Quit", &t_replacement);
326328
else if (t_action == kMCPlatformMenuItemActionPreferences)
327-
/* UNCHECKED */ MCStringCreateWithCString("Preferences", t_tag);
328-
else
329-
t_tag = MCValueRetain(kMCEmptyString);
329+
/* UNCHECKED */ MCStringCreateWithCString("Preferences", &t_replacement);
330+
331+
if (*t_replacement != nil)
332+
MCValueAssign(t_tag, *t_replacement);
330333
}
331-
else
332-
t_tag = MCValueRetain(p_menuitem -> tag);
333334

334335
MCPlatformSetMenuItemProperty(TopMenu(), t_item_index, kMCPlatformMenuItemPropertyTitle, kMCPlatformPropertyTypeMCString, &(p_menuitem -> label));
335336
MCPlatformSetMenuItemProperty(TopMenu(), t_item_index, kMCPlatformMenuItemPropertyTag, kMCPlatformPropertyTypeMCString, &t_tag);

0 commit comments

Comments
 (0)