On 11/7/12 5:59 AM, steve.carren wrote:
> Oops, I accidentally posted this question to the -dev list yesterday...
>
> Hello,
>
> I have a custom control that inherits from wx.EvtHandler (but not
> wx.Window). Several thousands of the controls may be dynamically created
> and destroyed while the applications is running. When the control is
> created its Bind() method is called to associate an event handler with
> the control. Currently, I do not call Unbind() when the control is
> destroyed. My question is: if I do not call Unbind(), will the
> wx/wxpython event handling code continue to keep some reference to the
> control or the binding between the control and handler, resulting in
> memory or performance issues?
No, it should be doing the right thing alread. A reference to the
handler function is held by the structure which is added to the dynamic
event table that is built by the Bind/Connect methods. That table and
its items (and the PyObject references) are released when the widget or
EvtHandler is destroyed.
--
Robin Dunn
Software Craftsman
http://wxPython.org