mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
ui/virtio-gpu: add and use qemu_create_displaysurface_pixman
Add a the new qemu_create_displaysurface_pixman function, to create a DisplaySurface backed by an existing pixman image. In that case there is no need to create a new pixman image pointing to the same backing storage. We can just use the existing image directly. This does not only simplify things a bit, but most importantly it gets the reference counting right, so the backing storage for the pixman image wouldn't be released underneath us. Use new function in virtio-gpu, where using it actually fixes use-after-free crashes. Cc: qemu-stable@nongnu.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1459499240-742-1-git-send-email-kraxel@redhat.com
This commit is contained in:
parent
9628af036f
commit
ca58b45fbe
4 changed files with 14 additions and 4 deletions
11
ui/console.c
11
ui/console.c
|
@ -1292,6 +1292,17 @@ DisplaySurface *qemu_create_displaysurface_from(int width, int height,
|
|||
return surface;
|
||||
}
|
||||
|
||||
DisplaySurface *qemu_create_displaysurface_pixman(pixman_image_t *image)
|
||||
{
|
||||
DisplaySurface *surface = g_new0(DisplaySurface, 1);
|
||||
|
||||
trace_displaysurface_create_pixman(surface);
|
||||
surface->format = pixman_image_get_format(image);
|
||||
surface->image = pixman_image_ref(image);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
static void qemu_unmap_displaysurface_guestmem(pixman_image_t *image,
|
||||
void *unused)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue