I just got bitten by qdev_get_machine()'s behaviour on the user-only
emulators, where it can return something that isn't NULL and isn't
an instance of TYPE_MACHINE either.

It looks like maybe this can happen in some cases in softmmu too,
judging by the way that qdev_get_hotplug_handler() does an
object_dynamic_cast() check that it really got back a TYPE_MACHINE.

Is this intentional? Does anything rely on qdev_get_machine()
returning something odd like this?

In the code I have which ran into this I can just make it do an
object_dynamic_cast() check like the hotplug_handler code does,
but if the current implementation is intentional we should
probably document that this is what you're supposed to do.

thanks
-- PMM

Reply via email to