Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.3
-
None
-
None
-
Mac OS X 10.5.8, Qt 4.6.3
-
-
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.