@samitouri / QOSamiQemu / commits / 63ab59d586

ui/qmp: keep a reference of console across yield

While the coroutine is waiting, the console could be finalized. Keep a reference to prevent this. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20260623-b4-ui-v4-10-4656aec3398d@redhat.com>

Marc-André Lureau committed Jun 23, 2026 at 11:44 UTC 63ab59d58696dfb6322157572ba6b3f5cd3f1437
1 file changed +3
ui/ui-qmp-cmds.c
+3
@@ -348,6 +348,7 @@ qmp_screendump(const char *filename, const char *device,
348 }
349 }
350
351 + object_ref(con);
352 qemu_console_co_wait_update(con);
353
354 /*
@@ -358,9 +359,11 @@ qmp_screendump(const char *filename, const char *device,
359 surface = qemu_console_surface(con);
360 if (!surface) {
361 error_setg(errp, "no surface");
362 + object_unref(con);
363 return;
364 }
365 image = pixman_image_ref(surface->image);
366 + object_unref(con);
367
368 fd = qemu_create(filename, O_WRONLY | O_TRUNC | O_BINARY, 0666, errp);
369 if (fd == -1) {