+Fri Nov 21 10:20:14 BST 2008 Daniel P. Berrange <berrange@redhat.com>
+
+ * src/remote_internal.c: Return VIR_NO_SUPPORT if requested
+ to register event callbacks when no eventloop is present.
+ Deal with failure to register handles/timers correctly.
+ (David Lively)
+
Fri Nov 21 10:14:14 BST 2008 Daniel P. Berrange <berrange@redhat.com>
Fix crash due to failure to unregister event callbacks on
conn, NULL)) < 0) {
DEBUG0("virEventAddTimeout failed: No addTimeoutImpl defined. "
"continuing without events.");
+ virEventRemoveHandle(priv->watch);
}
}
/* Successful. */
(xdrproc_t) xdr_void, (char *) NULL) == -1)
return -1;
- /* Remove handle for remote events */
- virEventRemoveHandle(priv->sock);
- /* Remove timout */
- virEventRemoveTimeout(priv->eventFlushTimer);
+ if (priv->eventFlushTimer >= 0) {
+ /* Remove timeout */
+ virEventRemoveTimeout(priv->eventFlushTimer);
+ /* Remove handle for remote events */
+ virEventRemoveHandle(priv->watch);
+ }
/* Close socket. */
if (priv->uses_tls && priv->session) {
{
struct private_data *priv = conn->privateData;
+ if (priv->eventFlushTimer < 0) {
+ error (conn, VIR_ERR_NO_SUPPORT, _("no event support"));
+ return -1;
+ }
if (virDomainEventCallbackListAdd(conn, priv->callbackList,
callback, opaque, freecb) < 0) {
error (conn, VIR_ERR_RPC, _("adding cb to list"));