aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qom/object_interfaces.c9
-rw-r--r--tests/check-qom-proplist.c4
2 files changed, 11 insertions, 2 deletions
diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index d4253a88de..ff27e0669e 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -4,6 +4,7 @@
#include "qemu/module.h"
#include "qapi-visit.h"
#include "qapi/opts-visitor.h"
+#include "qemu/config-file.h"
void user_creatable_complete(Object *obj, Error **errp)
{
@@ -181,6 +182,14 @@ void user_creatable_del(const char *id, Error **errp)
error_setg(errp, "object '%s' is in use, can not be deleted", id);
return;
}
+
+ /*
+ * if object was defined on the command-line, remove its corresponding
+ * option group entry
+ */
+ qemu_opts_del(qemu_opts_find(qemu_find_opts_err("object", &error_abort),
+ id));
+
object_unparent(obj);
}
diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c
index e3b3ae473e..8e432e9ab6 100644
--- a/tests/check-qom-proplist.c
+++ b/tests/check-qom-proplist.c
@@ -438,9 +438,9 @@ static void test_dummy_createcmdl(void)
* check for this in user_creatable_del() and remove the QemuOpts if
* it is present.
*
- * FIXME: add an assert to verify that the QemuOpts is cleaned up
- * once the corresponding cleanup code is added.
+ * The below check ensures this works as expected.
*/
+ g_assert_null(qemu_opts_find(&qemu_object_opts, "dev0"));
}
static void test_dummy_badenum(void)