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

QPainter drawText with rotated transform leaks GDI handles

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.0.0 RC 1
    • 5.0.0 Beta 1
    • GUI: Painting
    • None
    • Windows
    • cbf476242608a575595651a2eb8c40588a4631a4

    Description

      Calling QPainter.drawText with a rotated transform will leak a GDI handle for each glyph. On Windows 7, the application will crash when the GDI handle count reaches 10000. This can happen quite rapidly as shown in the attached demo project.

      BUG FOUND IN:
      /qtbase/src/plugins/platforms/windows/qwindowsfontengine.cpp (line 1113)

      SOLUTION:
      Change 'ReleaseDC(0, hdc);' to 'DeleteDC(hdc);'

      A similar bug may also be found in:
      /qtbase/src/plugins/platforms/windows/qwindowsfontdatabase.cpp (line 536)

      Attachments

        1. ScreenShot.png
          ScreenShot.png
          111 kB
        2. SimpleTest.zip
          115 kB
        For Gerrit Dashboard: QTBUG-27812
        # Subject Branch Project Status CR V

        Activity

          People

            e0348803 Miikka Heikkinen
            rmcalister Ryan McAlister
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes