[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/35] ui/console: fix crash when using gl context with non-gl lis
From: |
Gerd Hoffmann |
Subject: |
[PULL 28/35] ui/console: fix crash when using gl context with non-gl listeners |
Date: |
Fri, 4 Mar 2022 15:21:16 +0100 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
The commit 7cc712e98 ("ui: dispatch GL events to all listener")
mechanically replaced the dpy_gl calls with a dispatch loop, using the
same pre-conditions. However, it didn't take into account that all
listeners do not have to implement the GL callbacks.
Add the missing pre-conditions before calling the callbacks.
Fix crash when running a GL-enabled VM with "-device virtio-gpu-gl-pci
-display egl-headless -vnc :0".
Fixes: 7cc712e98 ("ui: dispatch GL events to all listener")
Reported-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220214201337.1814787-2-marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/console.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index 40eebb6d2cc2..79a01afd1ea7 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1860,7 +1860,9 @@ void dpy_gl_scanout_disable(QemuConsole *con)
con->scanout.kind = SCANOUT_NONE;
}
QLIST_FOREACH(dcl, &s->listeners, next) {
- dcl->ops->dpy_gl_scanout_disable(dcl);
+ if (dcl->ops->dpy_gl_scanout_disable) {
+ dcl->ops->dpy_gl_scanout_disable(dcl);
+ }
}
}
@@ -1881,10 +1883,12 @@ void dpy_gl_scanout_texture(QemuConsole *con,
x, y, width, height
};
QLIST_FOREACH(dcl, &s->listeners, next) {
- dcl->ops->dpy_gl_scanout_texture(dcl, backing_id,
- backing_y_0_top,
- backing_width, backing_height,
- x, y, width, height);
+ if (dcl->ops->dpy_gl_scanout_texture) {
+ dcl->ops->dpy_gl_scanout_texture(dcl, backing_id,
+ backing_y_0_top,
+ backing_width, backing_height,
+ x, y, width, height);
+ }
}
}
@@ -1897,7 +1901,9 @@ void dpy_gl_scanout_dmabuf(QemuConsole *con,
con->scanout.kind = SCANOUT_DMABUF;
con->scanout.dmabuf = dmabuf;
QLIST_FOREACH(dcl, &s->listeners, next) {
- dcl->ops->dpy_gl_scanout_dmabuf(dcl, dmabuf);
+ if (dcl->ops->dpy_gl_scanout_dmabuf) {
+ dcl->ops->dpy_gl_scanout_dmabuf(dcl, dmabuf);
+ }
}
}
@@ -1951,7 +1957,9 @@ void dpy_gl_update(QemuConsole *con,
graphic_hw_gl_block(con, true);
QLIST_FOREACH(dcl, &s->listeners, next) {
- dcl->ops->dpy_gl_update(dcl, x, y, w, h);
+ if (dcl->ops->dpy_gl_update) {
+ dcl->ops->dpy_gl_update(dcl, x, y, w, h);
+ }
}
graphic_hw_gl_block(con, false);
}
--
2.35.1
- [PULL 19/35] dsoundaudio: reduce effective playback buffer size, (continued)
- [PULL 19/35] dsoundaudio: reduce effective playback buffer size, Gerd Hoffmann, 2022/03/04
- [PULL 18/35] paaudio: reduce effective playback buffer size, Gerd Hoffmann, 2022/03/04
- [PULL 21/35] paaudio: fix samples vs. frames mix-up, Gerd Hoffmann, 2022/03/04
- [PULL 25/35] hw/i386: Improve bounds checking in OVMF table parsing, Gerd Hoffmann, 2022/03/04
- [PULL 20/35] ossaudio: reduce effective playback buffer size, Gerd Hoffmann, 2022/03/04
- [PULL 22/35] sdlaudio: fix samples vs. frames mix-up, Gerd Hoffmann, 2022/03/04
- [PULL 23/35] hw/usb/redirect.c: Stop using qemu_oom_check(), Gerd Hoffmann, 2022/03/04
- [PULL 24/35] coreaudio: Notify error in coreaudio_init_out, Gerd Hoffmann, 2022/03/04
- [PULL 29/35] ui/console: fix texture leak when calling surface_gl_create_texture(), Gerd Hoffmann, 2022/03/04
- [PULL 27/35] docs: Add spec of OVMF GUIDed table for SEV guests, Gerd Hoffmann, 2022/03/04
- [PULL 28/35] ui/console: fix crash when using gl context with non-gl listeners,
Gerd Hoffmann <=
- [PULL 30/35] ui: do not create a surface when resizing a GL scanout, Gerd Hoffmann, 2022/03/04
- [PULL 31/35] ui/clipboard: fix use-after-free regression, Gerd Hoffmann, 2022/03/04
- [PULL 32/35] ui/cocoa: Add Services menu, Gerd Hoffmann, 2022/03/04
- [PULL 26/35] hw/i386: Replace magic number with field length calculation, Gerd Hoffmann, 2022/03/04
- [PULL 33/35] softmmu/qdev-monitor: Add virtio-gpu-gl aliases, Gerd Hoffmann, 2022/03/04
- [PULL 35/35] hw/display/vmware_vga: replace fprintf calls with trace events, Gerd Hoffmann, 2022/03/04
- [PULL 34/35] edid: Fix clock of Detailed Timing Descriptor, Gerd Hoffmann, 2022/03/04
- Re: [PULL 00/35] Kraxel 20220304 patches, Peter Maydell, 2022/03/05