summary refs log tree commit diff stats
path: root/ui/gtk.c
diff options
context:
space:
mode:
authorDongwon Kim <dongwon.kim@intel.com>2023-06-26 17:53:16 -0700
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-06-27 17:08:56 +0200
commit2fc280734a6e7ab9263114214f06b6e69e54fabe (patch)
tree967ecddf60598484d672259a7d598099e070af97 /ui/gtk.c
parent7b41ca8d913cdd91d33d74d906dd5d7bd9f41045 (diff)
downloadfocaccia-qemu-2fc280734a6e7ab9263114214f06b6e69e54fabe.tar.gz
focaccia-qemu-2fc280734a6e7ab9263114214f06b6e69e54fabe.zip
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 <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20230627005316.5627-1-dongwon.kim@intel.com>
Diffstat (limited to 'ui/gtk.c')
-rw-r--r--ui/gtk.c5
1 files changed, 5 insertions, 0 deletions
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
 }