Charles Davis <cdavis5x(a)gmail.com> writes:
> @@ -1833,26 +1833,29 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx)
> return TRUE;
> }
>
> - if ((gl = get_gl_drawable( WindowFromDC( hdc ), hdc )))
> + if (!hdc || (gl = get_gl_drawable( WindowFromDC( hdc ), hdc )))
> {
> - if (ctx->fmt != gl->format)
> + if (gl && ctx->fmt != gl->format)
> {
> WARN( "mismatched pixel format hdc %p %p ctx %p %p\n", hdc, gl->format, ctx, ctx->fmt );
> SetLastError( ERROR_INVALID_PIXEL_FORMAT );
> goto done;
> }
>
> - TRACE("hdc %p drawable %lx fmt %p ctx %p %s\n", hdc, gl->drawable, gl->format, ctx->ctx,
> - debugstr_fbconfig( gl->format->fbconfig ));
> + if (gl)
> + TRACE("hdc %p drawable %lx fmt %p ctx %p %s\n", hdc, gl->drawable, gl->format, ctx->ctx,
> + debugstr_fbconfig( gl->format->fbconfig ));
> + else
> + TRACE("ctx %p (no drawable)\n", ctx->ctx);
>
> - ret = pglXMakeCurrent(gdi_display, gl->drawable, ctx->ctx);
> + ret = pglXMakeCurrent(gdi_display, gl ? gl->drawable : None, ctx->ctx);
> if (ret)
> {
> NtCurrentTeb()->glContext = ctx;
> ctx->has_been_current = TRUE;
> ctx->hdc = hdc;
> - ctx->drawables[0] = gl->drawable;
> - ctx->drawables[1] = gl->drawable;
> + ctx->drawables[0] = gl ? gl->drawable : 0;
> + ctx->drawables[1] = gl ? gl->drawable : 0;
You really want a separate code path instead of adding pointer checks
everywhere.
--
Alexandre Julliard
julliard(a)winehq.org