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

App crashes on termination if a font is loaded by unloaded library

XMLWordPrintable

      An application loads and unloads (this is essential) DLL plugins during its work. Some plugins contain Qt widgets. Some widgets are UI-based forms. If a font is specified in UI that isn't loaded by the app itself and a widget with such UI gets created during app lifetime, app crashes on termination deep inside QGuiApplication destructor (during QWindowsFontEngine destruction, to be more precise).

      It seems that QStringLiteral-s generated in ui_*.h code create QString-s that reference DLL memory, and unloading DLL invalidates that memory. Because QString-s are copy-on-write, a QString stored inside QWindowsFontEngine never gets deep-copied, which leads to crash when trying to access QString data after the DLL gets unloaded.

      I've attached an example which demonstrates the problem. Didn't try that on platforms other than Windows.

        1. qstringliteral.zip
          3 kB
          Sergey Blagodarin
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            laknoll Lars Knoll
            sergey Sergey Blagodarin
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes