On Sat, 05 May 2018 20:10:43 +0200 (CEST), Werner LEMBERG wrote:

> I agree with Gregor: A library should not call `exit' by itself.

What else is it supposed to do? Lots of code is already ignoring the
result from FT_Done_Face.

Exhibit A: HarfBuzz
<https://github.com/harfbuzz/harfbuzz/blob/master/src/hb-ft.cc>:

    static void
    _hb_ft_face_destroy (FT_Face ft_face)
    {
      FT_Done_Face (ft_face);
    }

Exhibit B: Fontconfig
<https://github.com/behdad/fontconfig/blob/master/src/fcdir.c>, which
also ignoring the result from FC_Done_FreeType:

    static FcBool
    FcFileScanFontConfig (FcFontSet             *set,
                  FcBlanks              *blanks,
                  const FcChar8 *file,
                  FcConfig              *config)
    {
        ...
        FT_Done_Face (face);
        ...

        FT_Done_FreeType (ftLibrary);

        return ret;
    }

Another pair of examples from Fontconfig
<https://github.com/behdad/fontconfig/blob/master/src/fcfreetype.c>:

    FcPattern *
    FcFreeTypeQuery(const FcChar8       *file,
            int         id,
            FcBlanks    *blanks,
            int         *count)
    {
        ...

        FT_Done_Face (face);
    bail:
        FT_Done_FreeType (ftLibrary);
        return pat;
    }

Exhibit C: libraqm
<https://github.com/HOST-Oman/libraqm/blob/master/src/raqm.c> (one of
3 instances):

    static void
    _raqm_free_text_info (raqm_t *rq)
    {
      if (!rq->text_info)
        return;

      for (size_t i = 0; i < rq->text_len; i++)
      {
        if (rq->text_info[i].ftface)
          FT_Done_Face (rq->text_info[i].ftface);
      }

      free (rq->text_info);
      rq->text_info = NULL;
    }

Is all this code wrong?

_______________________________________________
Freetype mailing list
Freetype@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype

Reply via email to