[wxPython] Problem with wxStyledTextCtrl after 2.3/ActiveState upgrade

Hi,
I've just upgraded to latest Python ActiveState and wxPython 2.3. I have a quite simple application consisting of 3 panes (splitter windows). The application reads a SQL file and presents the file in one pane (derived from wxStyledTextCtrl), a list of errors (syntax, semantic) in the file in another pane (derived from wxListCtrl) and the actual interpretation of the content of the file in the last pane (derived from wxTreeCtrl). If the user selects an item in the list control, the corresponding line in the wxStyledTextCtrl is selected/highlighted by the following code (method in the wxStyledTextCtrl):

def SetActiveLine(self, lineNbr):
        if lineNbr < 0:
            lineNbr = 1
        self.ScrollToLine(lineNbr-1)
        if self.PrevLine >= 0:
            self.MarkerDeleteAll(0) #(self.PrevLine)
        self.MarkerAdd(lineNbr-1, 0)
        self.PrevLine = lineNbr-1

The same happens when an item in the tree control is chosen - the corresponding line in the file is selected/highlighted by using the same method. Now the problem. When I terminate the application (either 'Exit' or 'Close') I get an exception if an item in the tree-control has been selected (and the corresponding line in the wxStyledTextCtrl is selected). Selecting item in the list-control works ok.

The exception is a message that a particular memory location could not be read.

Any help is appreciated. Thanks in advance.

Nikolai

PS: The total size of the application is 428 + 122 lines. I'll send it if anyone would like to have a look.

The same happens when an item in the tree control is chosen -
the corresponding line in the file is selected/highlighted by
using the same method. Now the problem. When I terminate
the application (either 'Exit' or 'Close') I get an exception
if an item in the tree-control has been selected (and the
corresponding line in the wxStyledTextCtrl is selected).
Selecting item in the list-control works ok.

Sometimes (usually on MSW) events can be delivered after an object has
already been destroyed (the C++ half of the object anyway.) There was some
recent converstation on this list about this problem with Focus events...

In your case since it is just with the tree, it may be that as the selected
item in the tree is being deleted then a deselect event followed by a select
event (for the item's parent) are being sent and your event handlers are
crashing because the text window it tries to update is gone.

A solution could be as simple as deselecting the tree item before shutting
down the app, or changing your event handlers to just return immediately if
the app is currently shutting down (set a flag in the Frame's OnClose.)

···

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