Skip to content
Commit 40edd409 authored by Michel Dänzer's avatar Michel Dänzer Committed by Adam Jackson
Browse files

glamor: Store the actual EGL/GLX context pointer in lastGLContext



Fixes subtle breakage which could sometimes trigger after a server reset
with multiple screens using glamor:

Screen A enters glamor_close_screen last and calls various cleanup
functions, which at some point call glamor_make_current to make sure
screen A's GL context is current. This sets lastGLContext to screen A's
&glamor_priv->ctx. Finally, glamor_close_screen calls
glamor_release_screen_priv, which calls free(glamor_priv).

Later, screen B enters glamor_init, which allocates a new glamor_priv.
With bad luck, this can return the same pointer which was previously
used for screen A's glamor_priv. So when screen B's glamor_init calls
glamor_make_current, lastGLContext == &glamor_priv->ctx, so MakeCurrent
isn't called for screen B's GL context, and the following OpenGL API
calls triggered by glamor_init mess up screen A's GL context.

The observed end result of this was a crash in glamor_get_vbo_space
because glamor_priv->vbo didn't match the GL context, though there might
be other possible outcomes.

Assigning the actual GL context pointer to lastGLContext prevents this
by preventing the false negative test in glamor_make_current.

Reviewed-by: default avatarKeith Packard <keithp@keithp.com>
Reviewed-by: default avatarEric Anholt <eric@anholt.net>
(cherry picked from commit 7c88977d)
parent 7c4f7b3a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment