Hello to WxPython developers,
Did anyone ever encounter an issue where wxpython references a deleted object from the loop?
I have an application where I add and remove panels that contain controls for a frame - pretty standard form interface.
In very particular cases that I can reproduce in my app, where I create a new panel and then immediately delete it WxPython seems to reference deleted objects.
On Windows I get a message box with the following text:
“Couldn’t retrieve information about list control item 2.”
When I try to see the offending command with a debugger it seems it is generated by the WxPython Loop, after the panel deletion event has been processed. And this happens only in certain rare conditions where I changed the text in a text box before creating the new panel I am deleting, so I do not think this is something I am doing terribly wrong - although reproducible, it is very rare and not caught by the debugger during event processing and does not happen in other forms that are somewhat similar.
When executed on a Linux system, however, the system gives an error message on screen:
Traceback (most recent call last):
File “/home/work/Desktop/MISTtst/CDMLib.py”, line 841, in FrameEventHandler
if Exist(this_panel) and this_panel.isRow:
File “/home/work/anaconda/lib/python2.7/site-packages/wx-3.0-gtk2/wx/_core.py”, line 16708, in getattr
raise PyDeadObjectError(self.attrStr % self._name)
wx._core.PyDeadObjectError: The C++ part of the RowPanel object has been deleted, attribute access no longer allowed.
This indicates that something happens after deletion and may explain what happens on windows, yet may be separate.
Note that panel deletion is triggered by pressing a button on the panel and handling its event and exiting the function.
Does someone have any idea of what may be going on, or what should I look for?
I am not sure I can easily create a small simple application that reproduces this issue since it happens in very rare cases of a certain click and entry sequence. Yet I hope there is sufficient information here to give someone a clue.
Jacob