Commit 9d5139e5 authored by Eduardo Habkost's avatar Eduardo Habkost
Browse files

vl: Clean up user-creatable objects when exiting



Delete all user-creatable objects in /objects when exiting QEMU, so they
can perform cleanup actions.

Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170824192315.5897-2-ehabkost@redhat.com>
Acked-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: default avatarZack Cornelius <zack.cornelius@kove.net>
Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
parent a9158a5c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -147,4 +147,12 @@ int user_creatable_add_opts_foreach(void *opaque,
 */
void user_creatable_del(const char *id, Error **errp);

/**
 * user_creatable_cleanup:
 *
 * Delete all user-creatable objects and the user-creatable
 * objects container.
 */
void user_creatable_cleanup(void);

#endif
+5 −0
Original line number Diff line number Diff line
@@ -193,6 +193,11 @@ void user_creatable_del(const char *id, Error **errp)
    object_unparent(obj);
}

void user_creatable_cleanup(void)
{
    object_unparent(object_get_objects_root());
}

static void register_types(void)
{
    static const TypeInfo uc_interface_info = {
+1 −0
Original line number Diff line number Diff line
@@ -4887,6 +4887,7 @@ int main(int argc, char **argv, char **envp)
    audio_cleanup();
    monitor_cleanup();
    qemu_chr_cleanup();
    user_creatable_cleanup();
    /* TODO: unref root container, check all devices are ok */

    return 0;