From 2fc280734a6e7ab9263114214f06b6e69e54fabe Mon Sep 17 00:00:00 2001 From: Dongwon Kim Date: Mon, 26 Jun 2023 17:53:16 -0700 Subject: [PATCH] ui/gtk: making dmabuf NULL when it's released. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Cc: Marc-André Lureau Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim Reviewed-by: Marc-André Lureau Message-ID: <20230627005316.5627-1-dongwon.kim@intel.com> --- ui/gtk.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index e09e164482..8ba41c8f13 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -583,7 +583,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 }