[Phoenix, BUG] Calling InspectorTool twice -> Wrapped C/C++ object deleted

Hi!
When I call wx.lib.inspection.InspectionTool().Show(), close the tool,
and execute the same line again, I get a RuntimeError:
"wrapped C/C++ object of type FillingText has been deleted"

The issue seems to be that wx.py.dispatcher stores weakrefs to its
receivers in a module-level dict. When InspectorTool is first
instantiated, that data is populated. When calling InspectorTool the
second time, dispatcher tries to notify the old callbacks. The Python
objects for those are still around, but the C++ backends were destroyed
when the window was closed. Thus the RuntimeError.

No idea how to fix this, though. Should the Python objects go South when
the window is closed (so the weakrefs invalidate)? Or is dispatcher.py
doing something wrong?

The test script, traceback and a part of my pdb session are attached.

Environment:
Python 3.4.3 (v3.4.3:9b73f1c3e601) [MSC v.1600 32 bit (Intel)] on win32
wxPython 3.0.3.dev1820+49a8884 msw (phoenix)
Windows 7 64 bit (32 bit Python interpreter and Phoenix, though)

Cheers,
Chris

bugreport.txt (2.89 KB)

Hi,

Just FYI, I see the same thing with Phoenix but it works if I run it against 3.0.2 classic.

Werner

ยทยทยท

On 4/24/2015 4:06, Christian Aichinger wrote:

Hi!
When I call wx.lib.inspection.InspectionTool().Show(), close the tool,
and execute the same line again, I get a RuntimeError:
"wrapped C/C++ object of type FillingText has been deleted"

The issue seems to be that wx.py.dispatcher stores weakrefs to its
receivers in a module-level dict. When InspectorTool is first
instantiated, that data is populated. When calling InspectorTool the
second time, dispatcher tries to notify the old callbacks. The Python
objects for those are still around, but the C++ backends were destroyed
when the window was closed. Thus the RuntimeError.

No idea how to fix this, though. Should the Python objects go South when
the window is closed (so the weakrefs invalidate)? Or is dispatcher.py
doing something wrong?

The test script, traceback and a part of my pdb session are attached.

Environment:
Python 3.4.3 (v3.4.3:9b73f1c3e601) [MSC v.1600 32 bit (Intel)] on win32
wxPython 3.0.3.dev1820+49a8884 msw (phoenix)
Windows 7 64 bit (32 bit Python interpreter and Phoenix, though)

Cheers,
Chris