[PATCH] KFontChooser crashes when changing to fixed fonts

Ingo Klöcker kloecker at kde.org
Sun Feb 24 12:37:19 GMT 2008


On Saturday 23 February 2008, Chusslove Illich wrote:
> > [: Thomas McGuire :]
> > The reason is in setFamilyBoxItems() [...] causes a signal to be
> > emitted and then _k_family_chosen_slot() is called [...] will
> > crash.
>
> Nothing ought to react during setFamilyBoxItems() itself, as it is
> just an initialization step for setting up the display, and family
> selection etc. is always performed afterwards (in setupDisplay(),
> which setFont() calls at the end). The attached patch should be more
> according to this description. (Or, switching off the passive voice:
> I screwed up :)
>
> Does it also fix the issue for you?

Even if this patch fixes the issue it would be wise to add an assert 
(for the debug build) on familyListBox->currentItem() (and a 
corresponding comment) to make sure that a regression is noticed early 
and easily.

Moreover, I'd still apply Thomas patch. It's nice that 
familyListBox->currentItem() should never by NULL, but better safe than 
sorry.

Just stating the obvious: All dereferenced pointers SHOULD [1] be 
guarded by NULL-pointer checks (and, if appropriate, corresponding 
asserts should be added). And if a NULL-pointer check is omitted for 
whatever reasons (are there actually valid reasons?) an assert SHOULD 
be added.


Regards,
Ingo


[1] http://www.faqs.org/rfcs/rfc2119.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080224/7fb855a0/attachment.sig>


More information about the kde-core-devel mailing list