Re: [PATCH 5/6] Remove the event namespace concept

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2013-12-11 at 15:28 +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

...

> @@ -633,22 +640,17 @@ virObjectEventStateDispatchFunc(virConnectPtr conn,
>                                  void *opaque)
>  {
>      virObjectEventStatePtr state = opaque;
> -    virEventNamespaceID namespace = (event->eventID & 0xFF00) >> 8;
>  
>      /* Drop the lock whle dispatching, for sake of re-entrancy */
>      virObjectEventStateUnlock(state);
> -    switch (namespace) {
> -    case VIR_EVENT_NAMESPACE_DOMAIN:
> +    if (virObjectIsClass(event, virDomainEventGetBaseClass()))
>          virDomainEventDispatchDefaultFunc(conn, event,
>                  VIR_DOMAIN_EVENT_CALLBACK(cb), cbopaque, NULL);
> -        break;
> -    case VIR_EVENT_NAMESPACE_NETWORK:
> +    else if (virObjectIsClass(event, virNetworkEventGetBaseClass()))
>          virNetworkEventDispatchDefaultFunc(conn, event,
>                  VIR_NETWORK_EVENT_CALLBACK(cb), cbopaque, NULL);
> -        break;
> -    default:
> +    else
>          VIR_ERROR(_("Unknown event namespace to dispatch"));
> -    }
>      virObjectEventStateLock(state);
>  }

In this function we may get a crash if we have network event callback
registered but nothing registered for domain events. Indeed, in such a
case the virDomainEventGetBaseClass() would return NULL and we'll have a
crash when checking the inheritance.

This is why I see a crash with the patched virt-manager, and not with
the event-test.

--
Cedric

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]