Qt
  1. Qt
  2. QTBUG-46880

QFontCache crash when DLL is unloaded

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: P3: Somewhat important P3: Somewhat important
    • Resolution: Invalid
    • Affects Version/s: 5.4.2
    • Fix Version/s: None
    • Component/s: GUI: Font handling
    • Labels:
      None
    • Environment:

      Win7 x64, VS 2010

      Description

      When main app loads a DLL that uses a new font (a font that the main app does not use) and that DLL is unloaded then main app will crash when it is being closed.

      See attached files for an example (compile mainDll.cpp as a DLL and qfontcache_crash.h/cpp as an EXE):

      • start EXE
      • press load button
        >> a new widget with the text "test" will be added
      • press unload
        >> the new widget is removed and everything is cleaned up
      • close the app
      • a crash will occur

      Location of crash:
      qfont.cpp (line 2748) at command "engineDataCache.clear();"

      Qt 4.8 does not have this issue.

      1. mainDll.cpp
        0.4 kB
        ZTHawk
      2. QFontCache_Crash_On_App_Exit_Stack.txt
        3 kB
        Tom Ransdell
      3. QFontCache_Crash_On_Exit_Stack_Mac.txt
        7 kB
        Tom Ransdell
      4. qfontcache_crash.cpp
        2 kB
        ZTHawk
      5. qfontcache_crash.h
        0.3 kB
        ZTHawk
      6. QTBUG-46880.zip
        5 kB
        Qt Support

        Issue Links

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

          Activity

          Hide
          Arnaud Diederen added a comment -

          ZTHawk: That is correct: our problem is also with the UIC-generated code.
          But note that you can pass '-DQT_NO_UNICODE_LITERAL' to the compiler, and that will turn 'QStringLiteral' calls in 'QString::fromIDontRememberWhatExactly()' calls, and the plugins should then work just fine.

          Show
          Arnaud Diederen added a comment - ZTHawk: That is correct: our problem is also with the UIC-generated code. But note that you can pass '-DQT_NO_UNICODE_LITERAL' to the compiler, and that will turn 'QStringLiteral' calls in 'QString::fromIDontRememberWhatExactly()' calls, and the plugins should then work just fine.
          Hide
          Arnaud Diederen added a comment -

          Andy,

          in case you are interested to know more about our use-case: http://www.hexblog.com/?p=991

          Show
          Arnaud Diederen added a comment - Andy, in case you are interested to know more about our use-case: http://www.hexblog.com/?p=991
          Hide
          ZTHawk added a comment - - edited

          Reopening as it is valid due to the fact that QStringLiteral is generated by UIC. So it is no user generated code.

          @Arnaud Diederen
          Thx for the tip. I will try it.

          Show
          ZTHawk added a comment - - edited Reopening as it is valid due to the fact that QStringLiteral is generated by UIC. So it is no user generated code. @ Arnaud Diederen Thx for the tip. I will try it.
          Hide
          Tom Ransdell added a comment -

          FYI I had to build Qt 5.6.0 rc1 with configure -D QT_NO_UNICODE_LITERAL AND ALSO change all of my projects to build with -DQT_NO_UNICODE_LITERAL.

          I expected configure -D QT_NO_UNICODE_LITERAL to have been sufficient but it did not update any generated header with a #define QT_NO_UNICODE_LITERAL. Consequently I was forced to update all of our project to us also use -DQT_NO_UNICODE_LITERAL.

          Thanks for reopening this bug!

          Show
          Tom Ransdell added a comment - FYI I had to build Qt 5.6.0 rc1 with configure -D QT_NO_UNICODE_LITERAL AND ALSO change all of my projects to build with -DQT_NO_UNICODE_LITERAL. I expected configure -D QT_NO_UNICODE_LITERAL to have been sufficient but it did not update any generated header with a #define QT_NO_UNICODE_LITERAL. Consequently I was forced to update all of our project to us also use -DQT_NO_UNICODE_LITERAL. Thanks for reopening this bug!
          Hide
          Andy Shaw added a comment -

          I'll create a new one for the uic + QStringLiteral thing, it's going to get lost here otherwise

          Show
          Andy Shaw added a comment - I'll create a new one for the uic + QStringLiteral thing, it's going to get lost here otherwise

            People

            • Assignee:
              Eskil Abrahamsen Blomfeldt
              Reporter:
              ZTHawk
            • Votes:
              5 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes