Skip to content

Commit 7ce4d2a

Browse files
committed
[0.4.14][DESK] Fix GetDC/ReleaseDC error management
Fix missing ReleaseDC related to the spectrum (color depth) We leaked one device context for each bpp change within the desk.cpl-session, which gave the following logging when closing desk.cpl: (win32ss/user/ntuser/windc.c:749) err: [00060138] GetDC() without ReleaseDC()! 1 time for each leak. Partial backport of (#2707) Fix picked from 0.4.15-dev-2867-g d635ce0
1 parent e10d31f commit 7ce4d2a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dll/cpl/desk/settings.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,12 @@ OnBPPChanged(IN HWND hwndDlg, IN PSETTINGS_DATA pData)
472472
/* Show a new spectrum bitmap */
473473
hSpectrumControl = GetDlgItem(hwndDlg, IDC_SETTINGS_SPECTRUM);
474474
hSpectrumDC = GetDC(hSpectrumControl);
475+
if (hSpectrumDC == NULL)
476+
return;
477+
475478
GetClientRect(hSpectrumControl, &client);
476479
ShowColorSpectrum(hSpectrumDC, &client, dmNewBitsPerPel, pData);
480+
ReleaseDC(hSpectrumControl, hSpectrumDC);
477481

478482
/* Find if new parameters are valid */
479483
Current = pData->CurrentDisplayDevice->CurrentSettings;

0 commit comments

Comments
 (0)