[0.4.9][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 d635ce0cc0
This commit is contained in:
Joachim Henze 2021-07-06 00:51:17 +02:00
parent 06e09f0f95
commit aaf1943349

View file

@ -472,8 +472,12 @@ OnBPPChanged(IN HWND hwndDlg, IN PSETTINGS_DATA pData)
/* Show a new spectrum bitmap */
hSpectrumControl = GetDlgItem(hwndDlg, IDC_SETTINGS_SPECTRUM);
hSpectrumDC = GetDC(hSpectrumControl);
if (hSpectrumDC == NULL)
return;
GetClientRect(hSpectrumControl, &client);
ShowColorSpectrum(hSpectrumDC, &client, dmNewBitsPerPel, pData);
ReleaseDC(hSpectrumControl, hSpectrumDC);
/* Find if new parameters are valid */
Current = pData->CurrentDisplayDevice->CurrentSettings;