summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2014-01-24 10:48:58 +0100
committerGerd Hoffmann <kraxel@redhat.com>2014-03-10 13:55:20 +0100
commit4b87dc4c9729aaa77737d2f20c255231f4edb526 (patch)
tree215a116fca598114d9f97e5962009bdaebaf4f6e
parentf53f3d0a00b6df39ce8dfca942608e5b6a9a4f71 (diff)
downloadqemu-4b87dc4c9729aaa77737d2f20c255231f4edb526.tar.gz
qemu-4b87dc4c9729aaa77737d2f20c255231f4edb526.tar.bz2
qemu-4b87dc4c9729aaa77737d2f20c255231f4edb526.zip
spice: fix simple display surface handling
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--ui/spice-display.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 9bb42f1461..2a1fbda7bc 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -354,6 +354,7 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
DisplaySurface *surface)
{
SimpleSpiceUpdate *update;
+ bool need_destroy;
dprint(1, "%s/%d:\n", __func__, ssd->qxl.id);
@@ -366,14 +367,19 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
}
qemu_mutex_lock(&ssd->lock);
+ need_destroy = (ssd->ds != NULL);
ssd->ds = surface;
while ((update = QTAILQ_FIRST(&ssd->updates)) != NULL) {
QTAILQ_REMOVE(&ssd->updates, update, next);
qemu_spice_destroy_update(ssd, update);
}
qemu_mutex_unlock(&ssd->lock);
- qemu_spice_destroy_host_primary(ssd);
- qemu_spice_create_host_primary(ssd);
+ if (need_destroy) {
+ qemu_spice_destroy_host_primary(ssd);
+ }
+ if (ssd->ds) {
+ qemu_spice_create_host_primary(ssd);
+ }
memset(&ssd->dirty, 0, sizeof(ssd->dirty));
ssd->notify++;
@@ -610,8 +616,6 @@ static void qemu_spice_display_init_one(QemuConsole *con)
ssd->dcl.ops = &display_listener_ops;
ssd->dcl.con = con;
register_displaychangelistener(&ssd->dcl);
-
- qemu_spice_create_host_primary(ssd);
}
void qemu_spice_display_init(void)