ui/spice-app: implement display cleanup
Replace the atexit() handler with the display cleanup callback, reusing the existing spice_app_atexit() function. 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-18-4656aec3398d@redhat.com>
This commit is contained in:
@@ -119,16 +119,17 @@ static const TypeInfo char_vc_type_info = {
|
|||||||
.class_size = sizeof(VCChardevClass),
|
.class_size = sizeof(VCChardevClass),
|
||||||
};
|
};
|
||||||
|
|
||||||
static void spice_app_atexit(void)
|
static void spice_app_cleanup(void)
|
||||||
{
|
{
|
||||||
if (sock_path) {
|
if (sock_path) {
|
||||||
unlink(sock_path);
|
unlink(sock_path);
|
||||||
|
g_clear_pointer(&sock_path, g_free);
|
||||||
}
|
}
|
||||||
if (tmp_dir) {
|
if (tmp_dir) {
|
||||||
rmdir(tmp_dir);
|
rmdir(tmp_dir);
|
||||||
|
tmp_dir = NULL;
|
||||||
}
|
}
|
||||||
g_free(sock_path);
|
g_clear_pointer(&app_dir, g_free);
|
||||||
g_free(app_dir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void spice_app_display_early_init(DisplayOptions *opts)
|
static void spice_app_display_early_init(DisplayOptions *opts)
|
||||||
@@ -146,8 +147,6 @@ static void spice_app_display_early_init(DisplayOptions *opts)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
atexit(spice_app_atexit);
|
|
||||||
|
|
||||||
if (qemu_name) {
|
if (qemu_name) {
|
||||||
app_dir = g_build_filename(g_get_user_runtime_dir(),
|
app_dir = g_build_filename(g_get_user_runtime_dir(),
|
||||||
"qemu", qemu_name, NULL);
|
"qemu", qemu_name, NULL);
|
||||||
@@ -218,6 +217,7 @@ static QemuDisplay qemu_display_spice_app = {
|
|||||||
.type = DISPLAY_TYPE_SPICE_APP,
|
.type = DISPLAY_TYPE_SPICE_APP,
|
||||||
.early_init = spice_app_display_early_init,
|
.early_init = spice_app_display_early_init,
|
||||||
.init = spice_app_display_init,
|
.init = spice_app_display_init,
|
||||||
|
.cleanup = spice_app_cleanup,
|
||||||
.vc = "vc",
|
.vc = "vc",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user