mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 22:56:00 +00:00
[0.4.13][GDI32][BUTTERFLIES] Fix a BSOD caused by memory leak CORE-18498
The symptom was unhidden by (regression from users perspective): 0.4.12-dev-389-g5f2bebf7a5
by porting back: 0.4.15-dev-5608-gafb953ae4d
[BUTTERFLIES] Do not release the DC passed to OpenGL. CORE-18498 0.4.15-dev-5607-g8b19b6ec5a
[GDI32] Fix memory leak in case of public DC. CORE-18498 For now I will not port it back further than releases/0.4.12 although the code in both modules might be suboptimal even in earlier release-branches. But we see no symptoms in those yet.
This commit is contained in:
parent
f28daad01b
commit
69674a1e9d
2 changed files with 10 additions and 6 deletions
|
@ -12,6 +12,7 @@
|
|||
HINSTANCE hInstance; // Holds The Instance Of The Application
|
||||
|
||||
GLuint texture[3]; //stores texture objects and display list
|
||||
HDC hdcOpenGL;
|
||||
|
||||
LPCTSTR registryPath = _T("Software\\Microsoft\\ScreenSavers\\Butterflies");
|
||||
BOOL dRotate;
|
||||
|
@ -136,7 +137,7 @@ HGLRC InitOGLWindow(HWND hWnd)
|
|||
hRC = wglCreateContext(hDC);
|
||||
wglMakeCurrent(hDC, hRC);
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
hdcOpenGL = hDC;
|
||||
|
||||
return hRC;
|
||||
}
|
||||
|
@ -287,6 +288,7 @@ LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT message,
|
|||
case WM_DESTROY:
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
wglDeleteContext(hRC);
|
||||
ReleaseDC(hWnd, hdcOpenGL);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -755,7 +755,8 @@ SetDIBitsToDevice(
|
|||
if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID) & pDc_Attr))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
LinesCopied = 0;
|
||||
goto Exit;
|
||||
}
|
||||
/*
|
||||
if ( !pDc_Attr || // DC is Public
|
||||
|
@ -858,8 +859,7 @@ StretchDIBits(
|
|||
|
||||
if ( GdiConvertAndCheckDC(hdc) == NULL ) return 0;
|
||||
|
||||
pConvertedInfo = ConvertBitmapInfo(lpBitsInfo, iUsage, &ConvertedInfoSize,
|
||||
FALSE);
|
||||
pConvertedInfo = ConvertBitmapInfo(lpBitsInfo, iUsage, &ConvertedInfoSize, FALSE);
|
||||
if (!pConvertedInfo)
|
||||
{
|
||||
return 0;
|
||||
|
@ -896,7 +896,8 @@ StretchDIBits(
|
|||
if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID) & pDc_Attr))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
LinesCopied = 0;
|
||||
goto Exit;
|
||||
}
|
||||
/*
|
||||
if ( !pDc_Attr ||
|
||||
|
@ -910,6 +911,7 @@ StretchDIBits(
|
|||
ConvertedInfoSize, cjBmpScanSize,
|
||||
NULL);
|
||||
}
|
||||
Exit:
|
||||
if (pvSafeBits)
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, pvSafeBits);
|
||||
if (lpBitsInfo != pConvertedInfo)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue