[Mesa-dev] [PATCH] st/dri: Fix dangling pointer to a destroyed dri_drawable

Michel Dänzer michel at daenzer.net
Tue Apr 24 08:36:00 UTC 2018


On 2018-04-24 09:13 AM, Johan Helsing wrote:
> Emil: Your alternative patch won't work because dri_make_current is not necessarily called with NULL after a buffer has been destroyed.
> 
> 
> The problematic sequence is a pattern we use in QtWayland:
> 
> 
> //create temporary context
> 
> surface1 = eglCreateWindowSurface() <-- dri_drawable pointer is malloced
> 
> eglMakeCurrent(surface1) <-- ctx->dPriv is set
> 
> 
> // ... (Get some information about available GL extensions etc)
> 
> 
> eglDestroySurface(surface1) <-- pointer is freed, ctx->dPriv is now dangling

Is this the problem? The memory pointed to by ctx->dPriv shouldn't be
freed as long as the surface is bound to the current context?


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list