[wxPython-users] wx.lib.pubsub and wx.EVT_CLOSE

Eric Ongerth ericongerth at gmail.com
Sun Jun 3 21:20:16 PDT 2007


On 6/3/07, Josiah Carlson <jcarlson at uci.edu> wrote:
>
>
> Due to the pubsub using weakrefs, if you are using
> wx.lib.pubsub.Publisher.subscribe(topic, object.callback_method), then
> as long as the rest of your program isn't keeping a reference to the
> widget that you destroyed, pubsub should be dropping its reference to
> the callback.
>


Thanks, Josiah.  I guess the root of the problem, then, is that some parts
of my program must be keeping references to widgets that have been
destroyed.  Naively I was counting on Python's reference counting and
garbage collection to handle that, but now it makes sense to me that Python
can't be expected to succeed perfectly in that task, given the partial
disconnect of wxPython wrapping C++ wxWidgets.  Hmm!  Sounds like the
try/catch approach really is my best bet after all, at least in the
immediate future.  Thank you for the suggested method.  Can you suggest
where I might read up on more involved solutions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200706=
03/eb6a7a5b/attachment.htm


More information about the wxpython-users mailing list