wxTreeCtrl checking for valid IDs

Discussion in 'Python' started by Martin Drautzburg, Dec 27, 2004.

  1. I have run across a weired problem: I am using a wxTreeCtrl with a
    model for each tree node. The tree expands "lazily" and each time a
    node is expanded, its children (Views) are completely rebuilt,
    creating new IDs. The children register their respecive models using
    two self written classes "Model" and "View". I should note, that when
    collapsing, I delete children in a brute-force way, using
    CollapseAndReset().

    Each time a node is collapsed and expanded old nodes are deleted and
    new nodes (Views) are created, but the old ones are still registered
    as views for their models. When such a model issues a self.changed()
    all their views try to update themselves. But some of them are already
    gone and no longer tree nodes of my tree. Trying to update their
    labels gives me a SIGSEGV.

    I had similar problem with other widgets, but there I get a
    wx._core.PyDeadObjectError which I could handle easily. But the tree
    just gives me a SIGSEGV.

    So I have two options: either delete tree nodes more gently doing all
    the cleanup work, or figure out if a tree item is still part of the
    tree before the SIGSEGV gets me. The first will definitely require
    some sort of tree traversal, the second maybe not. But I haven't found
    a way to do this.

    If I am totally off the paved road, please tell me so.
     
    Martin Drautzburg, Dec 27, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Krzysztof Kaczkowski

    wxTreeCtrl event bug only win32?

    Krzysztof Kaczkowski, Aug 26, 2003, in forum: Python
    Replies:
    1
    Views:
    398
    Jarek Zgoda
    Aug 26, 2003
  2. Piet
    Replies:
    1
    Views:
    822
    Josiah Carlson
    Apr 4, 2004
  3. danielpm72

    How to read a wxTreeCtrl

    danielpm72, Apr 5, 2005, in forum: Python
    Replies:
    0
    Views:
    416
    danielpm72
    Apr 5, 2005
  4. Replies:
    2
    Views:
    731
    Beat Bolli
    Jun 21, 2005
  5. wxTreeCtrl Q?

    , Feb 1, 2006, in forum: Python
    Replies:
    1
    Views:
    378
    Raven
    Feb 1, 2006
Loading...

Share This Page