From: Marc-André Lureau <[email protected]> Guard the unregister by checking whether the listener callback was set, which only happens right before registration.
Cc: [email protected] Fixes: c7d80c7c1d9 ("multi-process: Associate fd of a PCIDevice with its object") Reviewed-by: Jagannathan Raman <[email protected]> Signed-off-by: Marc-André Lureau <[email protected]> --- hw/remote/remote-obj.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/remote/remote-obj.c b/hw/remote/remote-obj.c index 86192dc8dad..4e74ae76158 100644 --- a/hw/remote/remote-obj.c +++ b/hw/remote/remote-obj.c @@ -154,7 +154,9 @@ static void remote_object_finalize(Object *obj) RemoteObjectClass *k = REMOTE_OBJECT_GET_CLASS(obj); RemoteObject *o = REMOTE_OBJECT(obj); - device_listener_unregister(&o->listener); + if (o->listener.unrealize) { + device_listener_unregister(&o->listener); + } if (o->ioc) { qio_channel_shutdown(o->ioc, QIO_CHANNEL_SHUTDOWN_BOTH, NULL); -- 2.54.0
