[PATCH 5/7] wined3d: Don't try to cleanup an invalid context.

Henri Verbeet hverbeet at gmail.com
Fri Dec 4 10:47:15 CST 2020


On Thu, 3 Dec 2020 at 20:29, Matteo Bruni <mbruni at codeweavers.com> wrote:
>
> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49817
> Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
> ---
> In particular, if switching away from a destroyed context fails we
> call wined3d_context_gl_set_current(NULL) which will attempt to clear
> the current context again, recursively.
>
I don't think switching away from an invalid (i.e., one for which the
DC was destroyed) context should generally fail.

I didn't debug this, but from you description I gather there's an
issue with the context_restore_gl_context() in
wined3d_context_gl_cleanup(). It would be good to know what the
*exact* issue is there, but perhaps wined3d_context_gl_cleanup()
should call TlsSetValue(wined3d_context_tls_idx, NULL) before calling
context_restore_gl_context(), so that if it does end up failing, we at
least don't end up referencing a partially destroyed "old" context in
wined3d_context_gl_set_current(). We do that in
wined3d_context_gl_destroy() for similar reasons, but that doesn't
help when wined3d_context_gl_cleanup() is called from
wined3d_context_gl_set_current().



More information about the wine-devel mailing list