[wxPython-users] Re: Segmenation fault when exiting app
Robin Dunn
robin at alldunn.com
Wed Apr 25 14:16:56 PDT 2007
Franz Steinhäusler wrote:
> On Tue, 24 Apr 2007 10:45:40 -0700, Robin Dunn <robin at alldunn.com> wrote:
>
>> Franz Steinhaeusler wrote:
>>
>>> Sorry for getting a little OT.
>>> Is there anything else (I don't know gdb so good) to extract even more information.
>>>
>>> the backtrace is not the stack, isn't it.
>> It shows the C++ call stack, but not the data values on the stack.
>
> Ok.
>
> Meanwhile I could figure out the culprit. :)
>
> In easy words:
>
> (It happens only on gtk, windows seems to be more "robust" in that way or handles this in another way.
It's probably a difference of the order events are being sent, or if
they are sent at all during shutdown.
>
> If I'm wrong, please correct me
> When the Program exits, the frame is being destroyed.
> In the run of this procedure, the notebook tabs are destroyes, and in that process, event page changed is called.
> In the procedure of the pageeventchanged, the statustext was updated via SetStatusText of the frame.
> That lead to a segmentation fault. I looked how to check, if the frame is "valid". I found the promising function IsBeingDeleted
> and applied it that way:
>
> in OnNotebookTabChanged:
> if not self.grandparent.IsBeingDeleted():
> self.grandparent.txtDocumentArray[i].OnModified(None)
>
> #in that function, the status bar is updated;
> #self.grandparent.txtDocumentArray[i] is a styled text control.
>
>
> Would you solve that in another way or is it right so?
Yes, that looks correct. You could probably also check either of these
conditions:
if self.grandparent:
...
if not self.IsBeingDeleted():
...
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list