qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] ui/gtk: making dmabuf NULL when it's released.


From: Dongwon Kim
Subject: [PATCH v2] ui/gtk: making dmabuf NULL when it's released.
Date: Mon, 26 Jun 2023 17:53:16 -0700

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>
---
 ui/gtk.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index e50f950f2b..2a9a0d23e6 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -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
 }
 
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]