wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.34k stars 517 forks source link

Flatmenu demo crashes on Linux #2570

Open emersonrp opened 5 months ago

emersonrp commented 5 months ago

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 commented 5 months ago

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

infinity77 commented 3 months ago

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.

Metallicow commented 2 months ago

From reading the error comment, it appears the reverse logic chain map may be similar to a Wikipedia page. If you hit zero length curve or None it may be trying to ask you if you are root location(creator). There may not be a wayback function for the machine... It might have been destroyed already. This might be a macos/apple/Linux quirk. If so, it 99% would almost be hardware related if the two cannot get along.

reticulatus commented 2 months ago

I have retested using wxPython 4.2.2 gtk3 (phoenix) wxWidgets 3.2.6 + Python 3.12.3 + Linux Mint 22 and the FlatMenu example runs without crashing.