diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 5151e200812..cf99876af4f 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2318,14 +2318,17 @@ static int X11DRV_wglReleasePbufferDCARB( struct wgl_pbuffer *object, HDC hdc ) TRACE("(%p, %p)\n", object, hdc); EnterCriticalSection( &context_section ); + if (!XFindContext( gdi_display, (XID)hdc, gl_pbuffer_context, (char **)&gl )) { XDeleteContext( gdi_display, (XID)hdc, gl_pbuffer_context ); free_gl_drawable( gl ); } + else hdc = 0; + LeaveCriticalSection( &context_section ); - return DeleteDC(hdc); + return hdc && DeleteDC(hdc); } /**