wined3d: Always check the result of wglMakeCurrent().

This commit is contained in:
Henri Verbeet 2009-06-29 10:11:24 +02:00 committed by Alexandre Julliard
parent 40565211fb
commit f57967c983
2 changed files with 14 additions and 4 deletions

View File

@ -1073,7 +1073,10 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
* but enable it for the first context we create, and reenable it on the old context * but enable it for the first context we create, and reenable it on the old context
*/ */
if(oldDrawable && oldCtx) { if(oldDrawable && oldCtx) {
pwglMakeCurrent(oldDrawable, oldCtx); if (!pwglMakeCurrent(oldDrawable, oldCtx))
{
ERR("Failed to make previous GL context %p current.\n", oldCtx);
}
} else { } else {
last_device = This; last_device = This;
} }
@ -1201,7 +1204,11 @@ void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context) {
} }
/* Cleanup the GL context */ /* Cleanup the GL context */
pwglMakeCurrent(NULL, NULL); if (!pwglMakeCurrent(NULL, NULL))
{
ERR("Failed to disable GL context.\n");
}
if(context->isPBuffer) { if(context->isPBuffer) {
GL_EXTCALL(wglReleasePbufferDCARB(context->pbuffer, context->hdc)); GL_EXTCALL(wglReleasePbufferDCARB(context->pbuffer, context->hdc));
GL_EXTCALL(wglDestroyPbufferARB(context->pbuffer)); GL_EXTCALL(wglDestroyPbufferARB(context->pbuffer));

View File

@ -230,7 +230,10 @@ static void WineD3D_ReleaseFakeGLContext(void) {
if (0 == (--wined3d_fake_gl_context_ref) ) { if (0 == (--wined3d_fake_gl_context_ref) ) {
if(!wined3d_fake_gl_context_foreign && glCtx) { if(!wined3d_fake_gl_context_foreign && glCtx) {
TRACE_(d3d_caps)("destroying fake GL context\n"); TRACE_(d3d_caps)("destroying fake GL context\n");
pwglMakeCurrent(NULL, NULL); if (!pwglMakeCurrent(NULL, NULL))
{
ERR("Failed to disable fake GL context.\n");
}
pwglDeleteContext(glCtx); pwglDeleteContext(glCtx);
} }
if(wined3d_fake_gl_context_hdc) if(wined3d_fake_gl_context_hdc)
@ -301,7 +304,7 @@ static BOOL WineD3D_CreateFakeGLContext(void) {
/* Make it the current GL context */ /* Make it the current GL context */
if (!pwglMakeCurrent(wined3d_fake_gl_context_hdc, glCtx)) { if (!pwglMakeCurrent(wined3d_fake_gl_context_hdc, glCtx)) {
WARN_(d3d_caps)("Error setting default context as current for capabilities initialization\n"); ERR_(d3d_caps)("Failed to make fake GL context current.\n");
goto fail; goto fail;
} }
} }