QT+Xft fonts problem (kde crash). Analyzed. Need help with fix.

Denis Vlasenko vda at port.imtp.ilyichevsk.odessa.ua
Mon Apr 22 19:27:22 BST 2002


Many thanks!
This is what I call 'quick fix'! A couple of hours only!
Mailed to kde mailing list, just in case
(base64 encoded to avoid mangling).

Will test it today at home.

On 22 April 2002 10:56, Trolltech wrote:
> thanks a lot for your report. The small patch attached should fix your
> problem.
>
> With best regards,
> Lars
>
> > [Forwarded here per advice on kde mailing list, please CC replies]
> >
> > Anybody willing to help please read on to the 'instrumenting patch'
> > part of this mail.
> >
> > kde3, X 4.2.0, kwin and other kde apps SIGSEGVing at startup.
> > I gdb'ed kwin crash (my first gdb session ever).
> > Synopsis: call sequence in kwin leading to NULL ptr dereference
> > (contact me directly for gory details).
> > Here is how it happens:
> >
> > XftPattern *QFontPrivate::findXftFont(const QChar &sample, bool *exact)
> > const {
> >     // look for foundry/family
> >     QString familyName;
> >     QString foundryName;
> >     QFontDatabase::parseFontName(request.family, foundryName,
> > familyName); XftPattern *match = bestXftPattern(familyName, foundryName);
> > match = checkXftFont( match, familyName, sample );  <-- match==0 ...
> > static XftPattern *checkXftFont( XftPattern *match,
> >                 const QString &familyName, const QChar &sample ){
> >     char * family_value;
> >     XftPatternGetString (match, XFT_FAMILY, 0, &family_value);  <--
> > match==0 ...
> > XftResult
> > XftPatternGetString (XftPattern *p, const char *object, int id, char **s)
> > {
> >     XftValue    v;
> >     XftResult   r;
> >     r = XftPatternGet (p, object, id, &v);  <-- p==0
> > ...
> > XftResult
> > XftPatternGet (XftPattern *p, const char *object, int id, XftValue *v)
> > {
> >     XftPatternElt   *e;
> >     XftValueList    *l;
> >     e = XftPatternFind (p, object, False);  <-- p==0
> > ...
> > XftPatternElt*
> > XftPatternFind(XftPattern *p, const char *object, Bool insert)
> > {
> >     int             i;
> >     int             s;
> >     XftPatternElt   *e;
> >
> >     /* match existing */
> >     for (i = 0; i < p->num; i++)      <-- p==0: SIGSEGV
> >     {
> >         if (!_XftStrCmpIgnoreCase (object, p->elts[i].object))
> >             return &p->elts[i];
> >     }
> >
> > I hope some QT wizards know whether it is valid to return NULL from
> > bestXftPattern() or not and where fix should go:
> >
> > - fix bestXftPattern() to never return NULL
> > or
> > - fix callers to check for NULL
[rest snipped]
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qfont_x11.diff
Type: text/x-diff
Size: 721 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde/attachments/20020422/43d404a2/attachment.diff>


More information about the kde mailing list