Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context menu crash #589

Closed
blitzmann opened this issue May 2, 2016 · 6 comments
Closed

Context menu crash #589

blitzmann opened this issue May 2, 2016 · 6 comments
Labels
bug Confirmed to be a bug fixed This issue has been fixed! Oh joy!

Comments

@blitzmann
Copy link
Collaborator

Some folks reporting context menu not showing up after a while. Pyfa doesn't crash, menu just stops working.

@blitzmann blitzmann added investigate Issue needs more investigation and discussion before a solve is implemented bug Confirmed to be a bug labels May 3, 2016
@Ebag333
Copy link
Contributor

Ebag333 commented May 10, 2016

Was able to recreate this while running from PyCharm. I added some debug output at the start (to show when we drop into contextMenu.py) and one under the "if m.display(srcContext, selection):" loop (to show which menus we open).

I've included a couple examples at the top where it works correctly, and then you'll see where it starts throwing tracebacks (and I start clicking around on various menus).

2016-05-09 20:00:59,477 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:00:59,479 gui.contextMenu          ERROR    Loop through registered menus: Module Stats
2016-05-09 20:00:59,487 gui.contextMenu          ERROR    Loop through registered menus: Module Market Group
2016-05-09 20:00:59,489 gui.contextMenu          ERROR    Loop through registered menus: Remove Module
2016-05-09 20:00:59,490 gui.contextMenu          ERROR    Loop through registered menus: Change Module Skills
2016-05-09 20:00:59,663 gui.contextMenu          ERROR    Loop through registered menus: Variations
2016-05-09 20:01:00,032 gui.contextMenu          ERROR    Loop through registered menus: Ship Stats
2016-05-09 20:01:00,033 gui.contextMenu          ERROR    Loop through registered menus: Open in Ship Browser
2016-05-09 20:01:00,035 gui.contextMenu          ERROR    Loop through registered menus: Change Ship Skills
2016-05-09 20:01:07,076 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:01:07,078 gui.contextMenu          ERROR    Loop through registered menus: Module Stats
2016-05-09 20:01:07,078 gui.contextMenu          ERROR    Loop through registered menus: Module Market Group
2016-05-09 20:01:07,078 gui.contextMenu          ERROR    Loop through registered menus: Remove Module
2016-05-09 20:01:07,079 gui.contextMenu          ERROR    Loop through registered menus: Change Module Skills
2016-05-09 20:01:07,325 gui.contextMenu          ERROR    Loop through registered menus: Variations
2016-05-09 20:01:07,325 gui.contextMenu          ERROR    Loop through registered menus: Ship Stats
2016-05-09 20:01:07,325 gui.contextMenu          ERROR    Loop through registered menus: Open in Ship Browser
2016-05-09 20:01:07,326 gui.contextMenu          ERROR    Loop through registered menus: Change Ship Skills
2016-05-09 20:06:51,963 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:06:51,976 gui.contextMenu          ERROR    Loop through registered menus: [u'Uniform', u'Burner Dramiel (Angel)', u'EM', u'Kinetic', u'Phased Plasma']
2016-05-09 20:08:02,339 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:08:02,351 gui.contextMenu          ERROR    Loop through registered menus: [u'Uniform', u'Burner Dramiel (Angel)', u'EM', u'Kinetic', u'Phased Plasma']
2016-05-09 20:08:38,187 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:08:42,377 gui.contextMenu          ERROR    Loop through registered menus: Charge
2016-05-09 20:08:42,437 gui.contextMenu          ERROR    Loop through registered menus: Module Stats
2016-05-09 20:08:42,440 gui.contextMenu          ERROR    Loop through registered menus: Module Market Group
2016-05-09 20:08:42,440 gui.contextMenu          ERROR    Loop through registered menus: Remove Module
2016-05-09 20:08:42,440 gui.contextMenu          ERROR    Loop through registered menus: Change Module Skills
2016-05-09 20:08:42,635 gui.contextMenu          ERROR    Loop through registered menus: Variations
2016-05-09 20:08:42,980 gui.contextMenu          ERROR    Loop through registered menus: Ship Stats
2016-05-09 20:08:42,980 gui.contextMenu          ERROR    Loop through registered menus: Open in Ship Browser
2016-05-09 20:08:42,982 gui.contextMenu          ERROR    Loop through registered menus: Change Ship Skills
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 16766, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinViews\fittingView.py", line 494, in spawnMenu
    menu = ContextMenu.getMenu(selection, *contexts)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 80, in getMenu
    sub = m.getSubMenu(srcContext, selection, rootMenu, it, rootItem)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinContextMenus\changeAffectingSkills.py", line 84, in getSubMenu
    levelItem = self.addSkill(rootMenu if msw else grandSub, skill, i)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinContextMenus\changeAffectingSkills.py", line 65, in addSkill
    menuItem = wx.MenuItem(rootMenu, id, label, kind=wx.ITEM_RADIO)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:08:43,213 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:08:43,253 gui.contextMenu          ERROR    Loop through registered menus: Charge
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 16766, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinViews\fittingView.py", line 494, in spawnMenu
    menu = ContextMenu.getMenu(selection, *contexts)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:09:18,730 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:09:18,730 gui.contextMenu          ERROR    Loop through registered menus: Module Stats
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 16766, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinViews\fittingView.py", line 494, in spawnMenu
    menu = ContextMenu.getMenu(selection, *contexts)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:09:26,819 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:09:26,821 gui.contextMenu          ERROR    Loop through registered menus: Module Stats
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 16766, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinViews\fittingView.py", line 494, in spawnMenu
    menu = ContextMenu.getMenu(selection, *contexts)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:09:27,290 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:09:27,315 gui.contextMenu          ERROR    Loop through registered menus: Charge
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 16766, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinViews\fittingView.py", line 494, in spawnMenu
    menu = ContextMenu.getMenu(selection, *contexts)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:09:27,762 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:09:27,762 gui.contextMenu          ERROR    Loop through registered menus: Module Stats
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 16766, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinViews\fittingView.py", line 494, in spawnMenu
    menu = ContextMenu.getMenu(selection, *contexts)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:09:28,200 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:09:28,200 gui.contextMenu          ERROR    Loop through registered menus: Ship Stats
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 16766, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinViews\fittingView.py", line 494, in spawnMenu
    menu = ContextMenu.getMenu(selection, *contexts)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:09:28,588 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:09:28,591 gui.contextMenu          ERROR    Loop through registered menus: Ship Stats
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 16766, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinViews\fittingView.py", line 494, in spawnMenu
    menu = ContextMenu.getMenu(selection, *contexts)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:09:28,963 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:09:28,964 gui.contextMenu          ERROR    Loop through registered menus: Ship Stats
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 16766, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinViews\fittingView.py", line 494, in spawnMenu
    menu = ContextMenu.getMenu(selection, *contexts)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:09:29,471 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:09:29,476 gui.contextMenu          ERROR    Loop through registered menus: Charge
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 16766, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinViews\fittingView.py", line 494, in spawnMenu
    menu = ContextMenu.getMenu(selection, *contexts)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:09:29,904 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:09:29,904 gui.contextMenu          ERROR    Loop through registered menus: Module Stats
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 16766, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinViews\fittingView.py", line 494, in spawnMenu
    menu = ContextMenu.getMenu(selection, *contexts)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:09:30,568 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:09:30,569 gui.contextMenu          ERROR    Loop through registered menus: Ship Stats
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 16766, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinViews\fittingView.py", line 494, in spawnMenu
    menu = ContextMenu.getMenu(selection, *contexts)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:09:30,987 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:09:31,009 gui.contextMenu          ERROR    Loop through registered menus: Charge
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 16766, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\builtinViews\fittingView.py", line 494, in spawnMenu
    menu = ContextMenu.getMenu(selection, *contexts)
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:10:23,328 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:10:23,335 gui.contextMenu          ERROR    Loop through registered menus: [u'Uniform', u'Burner Dramiel (Angel)', u'EM', u'Kinetic', u'Phased Plasma']
Traceback (most recent call last):
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\statsPane.py", line 96, in handler
    menu = ContextMenu.getMenu(None, (viewName,))
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:10:25,986 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:10:25,993 gui.contextMenu          ERROR    Loop through registered menus: [u'Uniform', u'Burner Dramiel (Angel)', u'EM', u'Kinetic', u'Phased Plasma']
Traceback (most recent call last):
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\statsPane.py", line 96, in handler
    menu = ContextMenu.getMenu(None, (viewName,))
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:10:26,520 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:10:26,523 gui.contextMenu          ERROR    Loop through registered menus: [u'Uniform', u'Burner Dramiel (Angel)', u'EM', u'Kinetic', u'Phased Plasma']
Traceback (most recent call last):
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\statsPane.py", line 96, in handler
    menu = ContextMenu.getMenu(None, (viewName,))
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value
2016-05-09 20:10:26,959 gui.contextMenu          ERROR    Opening menu
2016-05-09 20:10:26,961 gui.contextMenu          ERROR    Loop through registered menus: [u'Uniform', u'Burner Dramiel (Angel)', u'EM', u'Kinetic', u'Phased Plasma']
Traceback (most recent call last):
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\statsPane.py", line 96, in handler
    menu = ContextMenu.getMenu(None, (viewName,))
  File "C:\Users\Ebag333\Documents\PyCharm\Pyfa\gui\contextMenu.py", line 77, in getMenu
    rootItem = wx.MenuItem(rootMenu, id, text)
  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_core.py", line 12435, in __init__
    _core_.MenuItem_swiginit(self,_core_.new_MenuItem(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "(itemid >= 0 && itemid < SHRT_MAX) || (itemid >= wxID_AUTO_LOWEST && itemid <= wxID_AUTO_HIGHEST)" failed at ..\..\src\common\menucmn.cpp(260) in wxMenuItemBase::wxMenuItemBase(): invalid itemid value

Process finished with exit code 0

@Ebag333
Copy link
Contributor

Ebag333 commented May 12, 2016

@blitzmann

I think I might have found the problem.

"Hunting through the forums it seems that itemid is ONLY passed as a low-word, even in 32-bit applications, meaning you can only have 32767 id's (UNLESS you allow negative id's as well!).

When this occurs, the item ID is always higher than 32767.

2016-05-12 10:43:56,545 gui.contextMenu ERROR id: '32776'

So for someone who doesn't use right click much, this isn't an issue. Since I'm a true EVE player and right click all the things, and a new ID is generated each time I right click (actually, looks like multiple IDs are generated each time you right click), explains why I run into this issue a lot.

The solution seems to be to have a pool of IDs and cycle through them.

The most egregious leaks are now plugged, but there will still be a slow leakage of IDs over time as graphs are opened and closed. This can be fixed by creating a pool of IDs, where the graph, etc. asks the pool for an id when it needs one and releases it to the pool when it is done.

Here's the bug report:
http://sasview.org/ticket/448

@blitzmann
Copy link
Collaborator Author

blitzmann commented May 15, 2016

Here's a little more information:

http://comments.gmane.org/gmane.comp.lib.wxwindows.general/84338

He suggests two (feasible) workarounds:

  • Properly destroy menu (personally I don't see how this would help unless the IDs are reused after destroying)
  • Simply catch and ignore the failed assertion. We'd have to make sure that this doesn't cause problems (the reason the assertion was added in wx2.9 was to prevent a menu using an already created ID, causing unexpected results)

I'll continue to look into this on my free time, but it's not a high priority as the problem goes away after restarting pyfa.

@Ebag333
Copy link
Contributor

Ebag333 commented May 15, 2016

In one of the two versions before the one we're on (2.8 or 2.9), they worked a bunch on this so that it would reuse the IDs and clean them up. At least that's my understanding.

So I'm guessing that we're not destroying the menus properly. Because of the submenu's we generate, we're generating a LOT of ID's each time we click. As an example:

2016-05-14 20:38:30,404 gui.contextMenu          ERROR    Selected Item: '[Module(ID=3017, name=Gatling Pulse Laser II) at 0x7cdecc0L]'
2016-05-14 20:38:30,785 gui.contextMenu          ERROR    Loop through registered menus: Charge
2016-05-14 20:38:30,785 gui.contextMenu          ERROR    id: '222'
<snip>
2016-05-14 20:38:30,943 gui.contextMenu          ERROR    Loop through registered menus: Change Ship Skills
2016-05-14 20:38:30,943 gui.contextMenu          ERROR    id: '435'

So that's 213 ID's generated for that particular menu, per click. So if you open up the context menu 100-150 times, you're done. That might be plenty for someone who uses the other shortcuts, but if you do everything through the context menu, you'll hit that pretty quick.

I'm guessing that this became noticeable when the skills were added, since that seems to be generating the bulk of the ID's.

Can we assign static ID's to any of these menu items, so we aren't recreating them every single time (seems to be one of the more popular options)? Can we generate the menu with less ID's?

@blitzmann
Copy link
Collaborator Author

blitzmann commented May 15, 2016

I played around with this a little last night and today. Very small change, but it works pretty fucking well (I am very surprised it was this straightforward)

https://github.com/blitzmann/Pyfa/tree/context-menu-ids

Basically I set up a class variable in ContextMenu that stores a list of IDs that have already been generated for the context menu in the past. Every time the context menu is spawned, the index resets to 0 so that we are always reusing the stuff in the list, and then increments that index for every ID request. If the list is too small, automatically append the list with a new ID to have it dynamically grow as needed.

I plan to pre-load it with ~200-300 IDs when it's initialized just so we have a good starting point. Bust current testing has proved promising.

@blitzmann
Copy link
Collaborator Author

See f9c5954

@blitzmann blitzmann added fixed This issue has been fixed! Oh joy! and removed investigate Issue needs more investigation and discussion before a solve is implemented labels May 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed to be a bug fixed This issue has been fixed! Oh joy!
Projects
None yet
Development

No branches or pull requests

2 participants