hw/remote: guard listener unregister in finalize
Guard the unregister by checking whether the listener callback was
set, which only happens right before registration.
Cc: jag.raman@oracle.com
Fixes: c7d80c7c1d ("multi-process: Associate fd of a PCIDevice with its object")
Reviewed-by: Jagannathan Raman <jag.raman@oracle.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user