summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2018-02-20 12:04:32 +0100
committerGerd Hoffmann <kraxel@redhat.com>2018-02-22 10:35:05 +0100
commitb09169282b3976075d434ae1cfd12de76ccbdcfd (patch)
treef79a7c4a23e789a0eea45bd8b804c3a0b81a8f62 /ui
parent6e1f2cb56047980dba8c4199b00968914b514c28 (diff)
downloadqemu-b09169282b3976075d434ae1cfd12de76ccbdcfd.tar.gz
egl-headless: cursor_dmabuf: handle NULL cursor
The cursor dmabuf can be NULL, in case no cursor defined by the guest. Happens for example when linux guests show the framebuffer console. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20180220110433.20353-3-kraxel@redhat.com
Diffstat (limited to 'ui')
-rw-r--r--ui/egl-headless.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/ui/egl-headless.c b/ui/egl-headless.c
index 00ff2c036a..b33e0b21fd 100644
--- a/ui/egl-headless.c
+++ b/ui/egl-headless.c
@@ -89,13 +89,16 @@ static void egl_cursor_dmabuf(DisplayChangeListener *dcl,
{
egl_dpy *edpy = container_of(dcl, egl_dpy, dcl);
- egl_dmabuf_import_texture(dmabuf);
- if (!dmabuf->texture) {
- return;
+ if (dmabuf) {
+ egl_dmabuf_import_texture(dmabuf);
+ if (!dmabuf->texture) {
+ return;
+ }
+ egl_fb_setup_for_tex(&edpy->cursor_fb, dmabuf->width, dmabuf->height,
+ dmabuf->texture, false);
+ } else {
+ egl_fb_destroy(&edpy->cursor_fb);
}
-
- egl_fb_setup_for_tex(&edpy->cursor_fb, dmabuf->width, dmabuf->height,
- dmabuf->texture, false);
}
static void egl_cursor_position(DisplayChangeListener *dcl,