ratbagd: remove devices before removing the context
This code isn't actually hit because we don't handle signals correctly, but
once we do, ratbagd_free() will assert because the devices never get removed.
@@ -485,9 +485,14 @@ static const struct ratbag_interface ratbagd_lib_interface = {
static struct ratbagd *ratbagd_free(struct ratbagd *ctx)
{
+ struct ratbagd_device *device;
+
if (!ctx)
return NULL;
+ RATBAGD_DEVICE_FOREACH(device, ctx)
+ ratbagd_device_unlink(device);
+
ctx->bus = sd_bus_flush_close_unref(ctx->bus);
ctx->monitor_source = sd_event_source_unref(ctx->monitor_source);
ctx->monitor = udev_monitor_unref(ctx->monitor);
