static void
-st_destroy_context_priv(struct st_context *st)
+st_destroy_context_priv(struct st_context *st, bool destroy_pipe)
{
uint shader, i;
st_invalidate_readpix_cache(st);
cso_destroy_context(st->cso_context);
+
+ if (st->pipe && destroy_pipe)
+ st->pipe->destroy(st->pipe);
+
free( st );
}
/* This can happen when a core profile was requested, but the driver
* does not support some features of GL 3.1 or later.
*/
- st_destroy_context_priv(st);
+ st_destroy_context_priv(st, false);
return NULL;
}
void st_destroy_context( struct st_context *st )
{
- struct pipe_context *pipe = st->pipe;
struct gl_context *ctx = st->ctx;
GLuint i;
/* This will free the st_context too, so 'st' must not be accessed
* afterwards. */
- st_destroy_context_priv(st);
+ st_destroy_context_priv(st, true);
st = NULL;
- pipe->destroy( pipe );
-
free(ctx);
}