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);
|
TRACE("hglrc: (%p)\n", hglrc);
|
||||||
if(ctx == NULL)
|
if(ctx == NULL)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Retrieve the HDC associated with the context to access the display driver */
|
/* Retrieve the HDC associated with the context to access the display driver */
|
||||||
dc = get_dc_ptr(ctx->hdc);
|
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");
|
if (!dc->funcs->pwglDeleteContext) FIXME(" :stub\n");
|
||||||
else ret = dc->funcs->pwglDeleteContext(hglrc);
|
else ret = dc->funcs->pwglDeleteContext(hglrc);
|
||||||
|
@ -609,6 +609,11 @@ static void test_deletecontext(HDC hdc)
|
|||||||
HANDLE thread_handle;
|
HANDLE thread_handle;
|
||||||
DWORD res, tid;
|
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)
|
if(!hglrc)
|
||||||
{
|
{
|
||||||
skip("wglCreateContext failed!\n");
|
skip("wglCreateContext failed!\n");
|
||||||
@ -639,6 +644,12 @@ static void test_deletecontext(HDC hdc)
|
|||||||
res = wglDeleteContext(hglrc);
|
res = wglDeleteContext(hglrc);
|
||||||
ok(res == TRUE, "wglDeleteContext failed\n");
|
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
|
/* WGL makes a context not current when deleting it. This differs from GLX behavior where
|
||||||
* deletion takes place when the thread becomes not current. */
|
* deletion takes place when the thread becomes not current. */
|
||||||
hglrc = wglGetCurrentContext();
|
hglrc = wglGetCurrentContext();
|
||||||
|
@ -1807,6 +1807,7 @@ BOOL CDECL X11DRV_wglDeleteContext(HGLRC hglrc)
|
|||||||
wine_tsx11_unlock();
|
wine_tsx11_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free_context(ctx);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user