If the call to dri_destroy_buffer is delayed until the next eglMakeCurrent, that would also solve the problem (I'm not sure how that would affect other things, though).
As long as dri_make_current doesn't compare against a dangling pointer, I'm happy. Johan ________________________________ From: Michel Dänzer <mic...@daenzer.net> Sent: Tuesday, April 24, 2018 10:36:00 AM To: Johan Helsing; Marek Olšák Cc: Daniel Stone; pekka.paala...@collabora.co.uk; ML Mesa-dev Subject: Re: [Mesa-dev] [PATCH] st/dri: Fix dangling pointer to a destroyed dri_drawable 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
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev