[Mesa-dev] [PATCH] st/dri: Fix dangling pointer to a destroyed dri_drawable
Johan Helsing
johan.helsing at qt.io
Tue Apr 24 08:44:58 UTC 2018
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 <michel at daenzer.net>
Sent: Tuesday, April 24, 2018 10:36:00 AM
To: Johan Helsing; Marek Olšák
Cc: Daniel Stone; pekka.paalanen at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180424/b3177f16/attachment.html>
More information about the mesa-dev
mailing list