Fwd: commit: Fix two segfaults in the Fonts combo box.

From: Hubert Figuiere (hub@nyorp.abisource.com)
Date: Fri Oct 04 2002 - 11:20:36 EDT

  • Next message: David Chart: "Commit: Changelogs"

    ----- Forwarded message from owner-abiword-dev@abisource.com -----

    Date: Sat, 5 Oct 2002 00:58:40 +1000 (EST)
    From: Martin Sevior <msevior@tauon.ph.unimelb.EDU.AU>
    To: abiword-dev@abisource.com
    Subject: commit: Fix two segfaults in the Fonts combo box.
    Message-ID: <Pine.OSF.4.44.0210050050150.15111-100000@tauon.ph.unimelb.EDU.AU>
    MIME-Version: 1.0
    Content-Type: TEXT/PLAIN; charset=US-ASCII

    CVS:
    ----------------------------------------------------------------------
    CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
    CVS:
    CVS: Committing in .
    CVS:
    CVS: Modified Files:
    CVS: ev/unix/ev_UnixToolbar.cpp xap/unix/xap_UnixFont.cpp
    CVS:
    ----------------------------------------------------------------------
    Fix two segfaults in fonts drop down combo.

    The first was due to an unitialized member variable in ev_UnixToolbar. It
    appears that gcc 3.2 does not zero these for us now.

    The second used to happen everytime you tried to select the "Konchi
    Gothic" font. XftConfig actually returned the link to the font not the
    font itself. The link had an extenstion ".font" but atcually points to a
    ttf. There is code in xap_UnixFont that determines what sort of font is
    present by the filename extension. I simply added an extra "else if" to
    handle these filename links.

    It would be good to find a cleverer solution but for now this works nicely
    on RH 8.0

    ie. This piece of code...
            if (stFontFile > 4)
            {
                    if (!UT_stricmp(m_fontfile + stFontFile - 4, ".ttf"))
                            m_fontType = FONT_TYPE_TTF;
                    else if (!UT_stricmp(m_fontfile + stFontFile - 4, ".pfa"))
                            m_fontType = FONT_TYPE_PFA;
                    else if (!UT_stricmp(m_fontfile + stFontFile - 4, ".pfb"))
                            m_fontType = FONT_TYPE_PFB;
                    else if (!UT_stricmp(m_fontfile + stFontFile - 5, ".font"))
                            m_fontType = FONT_TYPE_TTF;
            }

            if (m_fontType == FONT_TYPE_UNKNOWN)
                    return false;

    Cheers

    Martin

    PS. I built a non-debug AbiWord HEAD just now. It loads even faster than
    1.0.3 (since all those fonts aren't loaded into memory on start up). More
    features PLUS more speed - gotta love it :-)

    ----- End forwarded message -----



    This archive was generated by hypermail 2.1.4 : Fri Oct 04 2002 - 11:20:42 EDT