mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:23:07 +00:00
[SYSDM][DESK] Fix GetDC/ReleaseDC error management (#2707)
## Purpose [SYSDM] - When closing System Properties page, log show (win32ss/user/ntuser/windc.c:749) err: [00060138] GetDC() without ReleaseDC()! because GetDC() is called (multiple times) without properly calling ReleaseDC() as required in order to release a device context. - This module also lacks some error management in case null DC are provided (on error). - LiveCD Userinit, based on SYSDM is affected too. [DESK] - Fix missing ReleaseDC related to the spectrum (color depth) ## Proposed changes - ReleaseDC() added. - Error management in case of null DC. - Overall alignement of LiveCD Userinit and SYSDM.
This commit is contained in:
parent
9ca52142b6
commit
d635ce0cc0
3 changed files with 80 additions and 55 deletions
|
@ -34,6 +34,9 @@ InitLogo(PIMGINFO pImgInfo, HWND hwndDlg)
|
|||
COLORREF *pBits;
|
||||
INT line, column;
|
||||
|
||||
if (hDC == NULL || hDCLogo == NULL || hDCMask == NULL)
|
||||
goto Cleanup;
|
||||
|
||||
ZeroMemory(pImgInfo, sizeof(*pImgInfo));
|
||||
ZeroMemory(&bmpi, sizeof(bmpi));
|
||||
|
||||
|
@ -76,7 +79,7 @@ InitLogo(PIMGINFO pImgInfo, HWND hwndDlg)
|
|||
g = GetGValue(Color) * alpha / 255;
|
||||
b = GetBValue(Color) * alpha / 255;
|
||||
|
||||
*pBits++ = b | g << 8 | r << 16 | alpha << 24;
|
||||
*pBits++ = b | (g << 8) | (r << 16) | (alpha << 24);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,10 +91,11 @@ InitLogo(PIMGINFO pImgInfo, HWND hwndDlg)
|
|||
}
|
||||
|
||||
Cleanup:
|
||||
DeleteObject(hMask);
|
||||
DeleteObject(hLogo);
|
||||
DeleteDC(hDCMask);
|
||||
DeleteDC(hDCLogo);
|
||||
if (hMask != NULL) DeleteObject(hMask);
|
||||
if (hLogo != NULL) DeleteObject(hLogo);
|
||||
if (hDCMask != NULL) DeleteDC(hDCMask);
|
||||
if (hDCLogo != NULL) DeleteDC(hDCLogo);
|
||||
if (hDC != NULL) ReleaseDC(hwndDlg, hDC);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue