提交 a9bc123e 编写于 作者: M Matthias Bolte

vbox: Fix passing an empty IMedium* array to IMachine::Delete

vboxArray is not castable to a COM item type. vboxArray is a
wrapper around the XPCOM and MSCOM specific array handling.

In this case we can avoid passing NULL as an empty array to
IMachine::Delete by passing a dummy IMedium* array with a single
NULL item.
上级 52ee7c2b
...@@ -5294,11 +5294,10 @@ vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags) ...@@ -5294,11 +5294,10 @@ vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags)
((IMachine_Delete)machine->vtbl->Delete)(machine, &safeArray, &progress); ((IMachine_Delete)machine->vtbl->Delete)(machine, &safeArray, &progress);
# else # else
union { /* XPCOM doesn't like NULL as an array, even when the array size is 0.
vboxArray array; * Instead pass it a dummy array to avoid passing NULL. */
IMedium *medium; IMedium *array[] = { NULL };
} u = { .array = VBOX_ARRAY_INITIALIZER }; machine->vtbl->Delete(machine, 0, array, &progress);
machine->vtbl->Delete(machine, 0, &u.medium, &progress);
# endif # endif
if (progress != NULL) { if (progress != NULL) {
progress->vtbl->WaitForCompletion(progress, -1); progress->vtbl->WaitForCompletion(progress, -1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册