Re: Segfault on startup found


Subject: Re: Segfault on startup found
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Sat May 27 2000 - 18:09:44 CDT


On Sat, 27 May 2000, sam th wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Recently, Joaquin reported a problem with AbiWord crashing on startup.
> This happens to me too, so after a little fun with GDB and Bonsai, I
> figured out what happend, and who was to blame. :-)
>
> What happens is that in XAP_UnixFrame::_fe::focus_in_event()
> there is a call to pFrame->getCurrentView(). Except, as this GDB output
> shows, it doesn't exist.
>
> (gdb) print *pFrame VVVVVVVVVVVVVV
> $2 = {<XAP_Frame> = {m_app = 0x82c7198, m_pDoc = 0x831c120, m_pView = 0x0,
> m_pViewListener = 0x0, m_lid = 4294967295, m_pScrollObj = 0x0,
>
> Now, this function was written by hj, and commited by Martin, and hasn't
> been revised since. (Joaquin's changes are just indentation.)
>
> Adding the following guard:
>
> if(!pFrame->getCurrentView())
> return FALSE;
>
> before both line 45 and line 63 (where the same problem exists) seems to
> eliminate the problem. The return value is always false anyway, so that
> isn't a problem. If no one objects, I'll just commit that change. It
> probably isn't the right solution, but it's better than crashing.
>
>
 I agree that such situations can exist upon start up and are extremely
dangerous. They can also occur upon closing open frames in modeless
dialogs. We should take care to ensure that frames always exist when
passing around focus_in events. I think your solution is a good one.

Upon start up one can't be sure if a frame has been constructed before the
view so a simple test like yours to catch such special cases seems like a
good idea.

Cheers

Martin



This archive was generated by hypermail 2b25 : Sat May 27 2000 - 18:10:38 CDT