You can create the bug by editing the example meshviewer to disable one of the menu items with a submenu.
Code: Select all
Index: main.cpp
===================================================================
--- main.cpp (revision 1900)
+++ main.cpp (working copy)
@@ -646,6 +646,7 @@
submenu->addItem(L"sky box visible", 300, true, false, true);
submenu->addItem(L"toggle model debug information", 400, true, true);
submenu->addItem(L"model material", -1, true, true );
+ submenu->setItemEnabled(2, false);
submenu = submenu->getSubMenu(1);
submenu->addItem(L"Off", 401);
I am not sure if my fix is the best or most efficient, but I just added a check to see if menu items are disabled before expanding the submenu, and it seemed to correct the problem.
Here is my fix:
Code: Select all
Index: CGUIContextMenu.cpp
===================================================================
--- CGUIContextMenu.cpp (revision 1900)
+++ CGUIContextMenu.cpp (working copy)
@@ -378,7 +378,7 @@
for (s32 j=0; j<(s32)Items.size(); ++j)
if (Items[j].SubMenu)
{
- if ( j == i && canOpenSubMenu )
+ if ( j == i && canOpenSubMenu && Items[j].Enabled)
Items[j].SubMenu->setVisible(true);
else if ( j != i )
Items[j].SubMenu->setVisible(false);