Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-139245

QFontEngineFT uses brittle manual Glyph memory handling

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 6.10.0 Beta2
    • GUI: Font handling

      Coverity complains (at least CID 487585, but very probably more) about the guarded deletion of the result of loadGlyphFor(). Indeed, while most functions use the same condition for the deletion, QFontEngineFT::glyphData() does not, in its return nullptr branch.

      Suggest to port the code from raw pointers to some form of unique_ptr, maybe with a deleter that contains a bool needsDeletion, set to the ever-repeated !cacheEnabled && get() != &emptyGlyph at construction.

      Without this, there are so many questions about this code, like is the condition in QFontEngineFT::glyphData() equivalent to the condition in the other users? Or what happens if cacheEnabled changes between the creation of the Glyph and its destruction? Can it?

      Not least, it would DRY the repeated guarded deletes strewn over the code.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            esabraha Eskil Abrahamsen Blomfeldt
            mmutz Marc Mutz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes