OSDN Git Service

st/mesa: destroy pipe_context before destroying st_context (v2)
authorMarek Olšák <marek.olsak@amd.com>
Fri, 20 Jan 2017 01:26:42 +0000 (02:26 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 3 Feb 2017 11:08:54 +0000 (11:08 +0000)
commitd701877fb05251d26a040d1c3809681b56ae160b
tree868f7afe6340d4a8c42978657959656251f572fe
parentb2bbfca79f8b29f9cc60ed6bb22cb7023284a781
st/mesa: destroy pipe_context before destroying st_context (v2)

If radeonsi starts compiling an optimized shader variant asynchronously
with a GL debug callback set and the application destroys the GL context,
radeonsi crashes when trying to write shader stats into the debug output
of a non-existent context after compilation, because st/mesa was destroyed
before pipe_context.

Firefox with WebGL2 enabled hits this bug.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99456

v2: protect against a double destroy in st_create_context_priv and callers.

Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit d9ef54923804d5fe44a1d3ad5c29e9b8e8382359)
src/mesa/state_tracker/st_context.c