case SYSVIEW_EVENT_SESSION_REMOVE:
idev_session_disable(e->idev_session);
e->idev_session = idev_session_free(e->idev_session);
- sd_event_exit(e->event, 0);
+ if (sd_event_get_exit_code(e->event, &r) == -ENODATA)
+ sd_event_exit(e->event, 0);
break;
case SYSVIEW_EVENT_SESSION_ATTACH:
d = ev->session_attach.device;
grdev_session_restore(m->grdev_session);
grdev_session_disable(m->grdev_session);
m->grdev_session = grdev_session_free(m->grdev_session);
- sd_event_exit(m->event, 0);
+ if (sd_event_get_exit_code(m->event, &r) == -ENODATA)
+ sd_event_exit(m->event, 0);
break;
case SYSVIEW_EVENT_SESSION_ATTACH:
d = ev->session_attach.device;
log_debug("sysview: stop");
- c->running = false;
- c->scanned = false;
- c->event_fn = NULL;
- c->userdata = NULL;
- c->scan_src = sd_event_source_unref(c->scan_src);
- context_ud_stop(c);
- context_ld_stop(c);
-
- /*
- * Event-callbacks are already cleared, hence we can safely ignore
- * return codes of the context_remove_*() helpers. They cannot be
- * originated from user-callbacks, so we already handled them.
- */
-
while ((device = hashmap_first(c->device_map)))
context_remove_device(c, device);
while ((seat = hashmap_first(c->seat_map)))
context_remove_seat(c, seat);
+
+ c->running = false;
+ c->scanned = false;
+ c->event_fn = NULL;
+ c->userdata = NULL;
+ c->scan_src = sd_event_source_unref(c->scan_src);
+ context_ud_stop(c);
+ context_ld_stop(c);
}
static int context_scan_fn(sd_event_source *s, void *userdata) {