AW: Re: Crash while calling Destroy()

Hello,

and thanks for the quick response!
I played with your suggestions but nothing had a satisfying result.
I replaced the for loop with the FindWindowByName(): No success
I wrote a lot of debug print's: The method is only called once
I tried CallAfter: Crash

This is so strange :frowning:
I'll try to write a simple app which reproduces this behaviour.

cu alex

路路路

-----Urspr眉ngliche Nachricht-----
Datum: Tue, 07 Oct 2008 16:37h
Von: Robin Dunn <robin@alldunn.com>
An: wxpython-users@lists.wxwidgets.org
Betreff: Re: [wxpython-users] Crash while calling Destroy()

Alexander Fischer wrote:

Hello,

I'm writing an application with a wx.treectrl on the left and a panel on the right. Every item selection destroys a panel on the right and adds a new one. Until wxPython 2.8.8.1 all was fine, but with the new 2.8.9.1 version, my application crashes without any feedback while calling the panels Destroy() method.
I wish i could give you an example of this, but I'm not able to write a less complex application, that reproduces this behaviour, so i can't show you.

Has anybody an idea of what I'm doing wrong?

    def OnSelChanged(self, event = None):
        item = event.GetItem()
        if not item.IsOk():
            return
        #Delete old panel
        for i in self.parent.propertiesPanel.GetChildren():
            if i.GetName() == "propertyPanel":
                i.Destroy()

In addition to Tim's suggestions I would suggest trying to delay the
destroy until you are sure that there are no pending events for the
panel. You can do that with something like this:

  i.Hide()
  wx.CallAfter(i.Destroy)

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users