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

CGContextRef leak in qt_mac_cg_context

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.0
    • 4.6.3
    • None
    • None
    • Mac OS X 10.5.8, Qt 4.6.3
    • macOS
    • e4d59c1bd1ac43b65ed8b14d41ab488b8e3782bf

    Description

      There is a memory leak in qmacstyle_mac.mm's qt_mac_fill_background, although this function is currently unreferenced so this is inactive.

      qt_mac_fill_background calls qt_mac_cg_context to obtain a context, but does not release the reference. According to the comment at the top of qt_mac_cg_context, and the usage of it elsewhere, the returned context must be released by the caller.

      There is also a potential over-release inside qt_mac_cg_context, which I'm not sure is reachable or not. In the QInternal::MacQuartz case, the device's context is returned by calling it's cgContext() method. This method just returns the CGContextRef directly, so qt_mac_cg_context returns a context without incrementing the reference count.

      When the caller releases the reference returned to it by qt_mac_cg_context, it over-releases the device's context and so the device will be left with a stale pointer.

      Attachments

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

        Activity

          People

            dzyubenk Denis Dzyubenko (Inactive)
            refnum Dair Grant
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes