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

Flatmenu demo crashes on Linux #2570

Open
emersonrp opened this issue Jul 1, 2024 · 2 comments
Open

Flatmenu demo crashes on Linux #2570

emersonrp opened this issue Jul 1, 2024 · 2 comments

Comments

@emersonrp
Copy link

Operating system: Manjaro Linux
wxPython version & source: 4.2.1 from Manjaro extra
Python version & source: 3.12.4 from Manjaro core

Description of the problem:

Clicking on the "Test Flatmenu" button in the Flatmenu demo panel fails with the following traceback:

Traceback (most recent call last):
  File "agw/FlatMenu.py", line 851, in OnButton
    self.win = FlatMenuDemo(self, self.log)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "agw/FlatMenu.py", line 229, in __init__
    self.ConnectEvents()
  File "agw/FlatMenu.py", line 506, in ConnectEvents
    self.Bind(FM.EVT_FLAT_MENU_SELECTED, self.OnEdit, id=MENU_DISABLE_MENU_ITEM, id2=MENU_REMOVE_MENU)
  File "/usr/lib/python3.12/site-packages/wx/core.py", line 1483, in _EvtHandler_Bind
    event.Bind(self, id, id2, handler)
  File "/usr/lib/python3.12/site-packages/wx/core.py", line 1554, in Bind
    target.Connect(id1, id2, et, function)
wx._core.wxAssertionError: C++ assertion "idLast == wxID_ANY || winid <= idLast" failed at /usr/src/debug/wxwidgets/wxWidgets/include/wx/event.h(3478) in wxEventTableEntryBase(): invalid IDs range: lower bound > upper bound
@reticulatus
Copy link
Contributor

The demo runs without crashing when using wxPython 4.2.1 + Python 3.10.12 + Linux Mint 21.3.

@infinity77
Copy link
Contributor

The FlatMenu code creates the two menu items IDs in a sequence, one after the other:

MENU_DISABLE_MENU_ITEM = wx.NewIdRef()
MENU_REMOVE_MENU = wx.NewIdRef()

My understanding is that MENU_REMOVE_MENU > MENU_DISABLE_MENU_ITEM. It is like that on Windows, and apparently it is like that on Linus as well per @reticulatus message.

Can it be a quirk of Python 3.12? No clue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants