diff options
| author | Dongwon Kim <dongwon.kim@intel.com> | 2024-05-08 10:53:58 -0700 |
|---|---|---|
| committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2024-05-14 17:14:12 +0400 |
| commit | e4e62514e3cc2fc9dbae44af8b80f61c730beab4 (patch) | |
| tree | 3090d355c6ce26a369080761194b1d3487f42228 /ui/gtk.c | |
| parent | 77bf310084dad38b3a2badf01766c659056f1cf2 (diff) | |
| download | focaccia-qemu-e4e62514e3cc2fc9dbae44af8b80f61c730beab4.tar.gz focaccia-qemu-e4e62514e3cc2fc9dbae44af8b80f61c730beab4.zip | |
ui/gtk: Check if fence_fd is equal to or greater than 0
'fence_fd' needs to be validated always before being referenced And the passing condition should include '== 0' as 0 is a valid value for the file descriptor. Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@linaro.org> Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Message-Id: <20240508175403.3399895-2-dongwon.kim@intel.com>
Diffstat (limited to 'ui/gtk.c')
| -rw-r--r-- | ui/gtk.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ui/gtk.c b/ui/gtk.c index 810d7fc796..7819a86321 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -597,10 +597,12 @@ void gd_hw_gl_flushed(void *vcon) VirtualConsole *vc = vcon; QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf; - qemu_set_fd_handler(dmabuf->fence_fd, NULL, NULL, NULL); - close(dmabuf->fence_fd); - dmabuf->fence_fd = -1; - graphic_hw_gl_block(vc->gfx.dcl.con, false); + if (dmabuf->fence_fd >= 0) { + qemu_set_fd_handler(dmabuf->fence_fd, NULL, NULL, NULL); + close(dmabuf->fence_fd); + dmabuf->fence_fd = -1; + graphic_hw_gl_block(vc->gfx.dcl.con, false); + } } /** DisplayState Callbacks (opengl version) **/ |