Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.4.0 Alpha
-
None
-
Qt 5.3.x
Windows 7 Professional
Visual Studio 2013
-
28857e7ad03bb416a1bae20b3771b799dee802c7
Description
QWindowsPrintDevice::printableMargins allocates a HDC with CreateDC, and then incorrectly tries to release it with ReleaseDC instead of DeleteDC. This results in a GDI object leak every time the function is called, eventually leading to a crash of the application.
See <http://msdn.microsoft.com/en-us/library/windows/desktop/dd162920(v=vs.85).aspx> :
An application cannot use the ReleaseDC function to release a DC that was created by calling the CreateDC function; instead, it must use the DeleteDC function.
The attached patch against Qt 5.3 replaces ReleaseDC with DeleteDC, which fixes the leak we observed.