ui/gtk: making dmabuf NULL when it's released.
PATCH 1/1 ui/gtk: making dmabuf NULL when it's released.
Set vc->gfx.guest_fb.dmabuf to NULL to prevent any further access to it after the dmabuf is released.
Cc Gerd Hoffmann <[email protected]>
Cc Marc-André Lureau <[email protected]>
Cc Vivek Kasireddy <[email protected]>
Signed-off-by Dongwon Kim <[email protected]>
--- ui/gtk.c | 4 ++++ 1 file changed, 4 insertions(+)
ui/gtk.c +4 -0
@@ -587,8 +587,12 @@ static bool gd_has_dmabuf(DisplayChangeListener *dcl)static void gd_gl_release_dmabuf (DisplayChangeListener *dcl,QemuDmaBuf *dmabuf) { +VirtualConsole *vc =container_of (dcl, VirtualConsole, gfx.dcl);#ifdef CONFIG_GBM egl_dmabuf_release_texture (dmabuf); +if (vc->gfx.guest_fb.dmabuf == dmabuf) { + vc->gfx.guest_fb.dmabuf =NULL ; + }#endif }
Signature · 1 line
2.34.1
ui/gtk.c static bool gd_has_dmabuf(DisplayChangeListener *dcl) · line 597
Quoted 11 lines · Dongwon Kim
static void gd_gl_release_dmabuf(DisplayChangeListener *dcl,
QemuDmaBuf *dmabuf)
{ui/gtk.c +4
-0+VirtualConsole *vc =container_of (dcl, VirtualConsole, gfx.dcl);#ifdef CONFIG_GBM egl_dmabuf_release_texture (dmabuf); +if (vc->gfx.guest_fb.dmabuf == dmabuf) { + vc->gfx.guest_fb.dmabuf =NULL ; + }#endif }
Conditionally unused variable outside the ifdef.
r~
PATCH v2 1/1 ui/gtk: making dmabuf NULL when it's released.
Set vc->gfx.guest_fb.dmabuf to NULL to prevent any further access to it after the dmabuf is released.
v2: move declaration of vc inside ifdef
Cc Gerd Hoffmann <[email protected]>
Cc Marc-André Lureau <[email protected]>
Cc Vivek Kasireddy <[email protected]>
Signed-off-by Dongwon Kim <[email protected]>
--- ui/gtk.c | 5 +++++ 1 file changed, 5 insertions(+)
ui/gtk.c +5 -0
@@ -588,7 +588,12 @@ static void gd_gl_release_dmabuf(DisplayChangeListener *dcl, QemuDmaBuf *dmabuf) {#ifdef CONFIG_GBM +VirtualConsole *vc =container_of (dcl, VirtualConsole, gfx.dcl); +egl_dmabuf_release_texture (dmabuf); +if (vc->gfx.guest_fb.dmabuf == dmabuf) { + vc->gfx.guest_fb.dmabuf =NULL ; + }#endif }
Signature · 1 line
2.34.1