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

Qt can crash after exporting a PDF file with QPrinter due to deleted QFontEngines remaining in the QFontCache

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.8.7
    • 4.7.4, 4.8.0
    • None
    • Windows
    • 8960f7356796948b161159cff404a9ebd1624c5f

    Description

      Our application sometimes crashes when using cached fonts after exporting a PDF, because a font engine that is in the cache has been deleted. I tried to reproduce this in a smaller test case, but unfortunately couldn't - however we have a 100% reproducible case in our application.

      Exporting a PDF (or EPS) file with QPrinter uses a QFontSubset when embedding fonts. The destructor of this class deletes its QFontEngine if the reference count is zero, but it doesn't check the cache count. I think this is the problem - there's nothing stopping the font engine from being destroyed when it's still stored in the cache.

      The fix should be simple: just add a check for cache_count == 0 in the QFontSubset destructor, before the font engine is destroyed.

      Attachments

        Issue Links

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

          Activity

            People

              ritt.ks Konstantin Ritt
              jlarcombe James Larcombe
              Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes