diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index e5a7537e473..02328acd98d 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -185,6 +185,7 @@ fail: void dri_destroy_buffer(__DRIdrawable * dPriv) { + struct dri_context *ctx = dri_context(dPriv->driContextPriv); struct dri_drawable *drawable = dri_drawable(dPriv); struct dri_screen *screen = drawable->screen; struct st_api *stapi = screen->st_api; @@ -202,6 +203,9 @@ dri_destroy_buffer(__DRIdrawable * dPriv) /* Notify the st manager that this drawable is no longer valid */ stapi->destroy_drawable(stapi, &drawable->base); + if (ctx && ctx->dPriv == dPriv) + ctx->dPriv = NULL; + FREE(drawable); }