winex11.drv: Ensure that the WGL context is removed from the context list in wglDeleteContext.
This commit is contained in:
parent
4d86e49173
commit
c4a8de92c4
|
@ -135,11 +135,18 @@ BOOL WINAPI wglDeleteContext(HGLRC hglrc)
|
|||
|
||||
TRACE("hglrc: (%p)\n", hglrc);
|
||||
if(ctx == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Retrieve the HDC associated with the context to access the display driver */
|
||||
dc = get_dc_ptr(ctx->hdc);
|
||||
if (!dc) return FALSE;
|
||||
if (!dc)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!dc->funcs->pwglDeleteContext) FIXME(" :stub\n");
|
||||
else ret = dc->funcs->pwglDeleteContext(hglrc);
|
||||
|
|
|
@ -609,6 +609,11 @@ static void test_deletecontext(HDC hdc)
|
|||
HANDLE thread_handle;
|
||||
DWORD res, tid;
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
res = wglDeleteContext(NULL);
|
||||
ok(res == FALSE, "wglDeleteContext succeeded\n");
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected last error to be ERROR_INVALID_HANDLE, got %u\n", GetLastError());
|
||||
|
||||
if(!hglrc)
|
||||
{
|
||||
skip("wglCreateContext failed!\n");
|
||||
|
@ -639,6 +644,12 @@ static void test_deletecontext(HDC hdc)
|
|||
res = wglDeleteContext(hglrc);
|
||||
ok(res == TRUE, "wglDeleteContext failed\n");
|
||||
|
||||
/* Attempting to delete the same context twice should fail. */
|
||||
SetLastError(0xdeadbeef);
|
||||
res = wglDeleteContext(hglrc);
|
||||
ok(res == FALSE, "wglDeleteContext succeeded\n");
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected last error to be ERROR_INVALID_HANDLE, got %u\n", GetLastError());
|
||||
|
||||
/* WGL makes a context not current when deleting it. This differs from GLX behavior where
|
||||
* deletion takes place when the thread becomes not current. */
|
||||
hglrc = wglGetCurrentContext();
|
||||
|
|
|
@ -1807,6 +1807,7 @@ BOOL CDECL X11DRV_wglDeleteContext(HGLRC hglrc)
|
|||
wine_tsx11_unlock();
|
||||
}
|
||||
|
||||
free_context(ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue