On Wed, 2013-12-11 at 15:28 +0000, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange(a)redhat.com>
...
@@ -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