Hi On Thu, Jan 28, 2021 at 6:42 PM Gerd Hoffmann <kra...@redhat.com> wrote: > > > > I still think that moving these three lines to the correct place is > > > enough. Maybe even just qemu_spice_display_start() as it keeps track > > > of the state and you can safely call this twice. > > > > It's not enough, since the first time qemu_spice_display_start() is > > called (on vm_start) the display interfaces aren't yet registered. And > > spice server doesn't automatically start the newly added interfaces. > > So move the vmstate handler registration call too? > I'd prefer to not add more state variables if we can avoid it ... >
Does that seem right to you? diff --git a/ui/spice-core.c b/ui/spice-core.c index b621dd86b6..f592331ce4 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -46,7 +46,6 @@ static const char *auth = "spice"; static char *auth_passwd; static time_t auth_expires = TIME_MAX; static int spice_migration_completed; -static int spice_display_init_done; static int spice_display_is_running; static int spice_have_target_host; @@ -626,7 +625,7 @@ static int add_channel(void *opaque, const char *name, const char *value, static void vm_change_state_handler(void *opaque, int running, RunState state) { - if (running && spice_display_init_done) { + if (running) { qemu_spice_display_start(); } else if (state != RUN_STATE_PAUSED) { qemu_spice_display_stop(); @@ -635,7 +634,7 @@ static void vm_change_state_handler(void *opaque, int running, void qemu_spice_display_init_done(void) { - spice_display_init_done = true; + qemu_add_vm_change_state_handler(vm_change_state_handler, NULL); vm_change_state_handler(NULL, runstate_is_running(), runstate_get()); } @@ -810,7 +809,6 @@ static void qemu_spice_init(void) qemu_spice_input_init(); - qemu_add_vm_change_state_handler(vm_change_state_handler, NULL); qemu_spice_display_stop(); g_free(x509_key_file); -- Marc-André Lureau