winex11.drv: Set last error to ERROR_BUSY when attempting to delete a cross-thread context in wglDeleteContext.

This commit is contained in:
Andrew Nguyen 2010-11-07 01:15:01 -05:00 committed by Alexandre Julliard
parent c4a8de92c4
commit 1579ab0e01
2 changed files with 5 additions and 0 deletions

View File

@ -590,13 +590,16 @@ struct wgl_thread_param
HANDLE test_finished;
HGLRC hglrc;
BOOL hglrc_deleted;
DWORD last_error;
};
static DWORD WINAPI wgl_thread(void *param)
{
struct wgl_thread_param *p = param;
SetLastError(0xdeadbeef);
p->hglrc_deleted = wglDeleteContext(p->hglrc);
p->last_error = GetLastError();
SetEvent(p->test_finished);
return 0;
@ -638,6 +641,7 @@ static void test_deletecontext(HDC hdc)
{
WaitForSingleObject(thread_handle, INFINITE);
ok(thread_params.hglrc_deleted == FALSE, "Attempt to delete WGL context from another thread passed but should fail!\n");
ok(thread_params.last_error == ERROR_BUSY, "Expected last error to be ERROR_BUSY, got %u\n", thread_params.last_error);
}
CloseHandle(thread_params.test_finished);

View File

@ -1793,6 +1793,7 @@ BOOL CDECL X11DRV_wglDeleteContext(HGLRC hglrc)
if (ctx->tid != 0 && ctx->tid != GetCurrentThreadId())
{
TRACE("Cannot delete context=%p because it is current in another thread.\n", ctx);
SetLastError(ERROR_BUSY);
return FALSE;
}