ref:e5759171f1db97aa9f39bc2ce77746f0b1d53497

fix(linux/publish): release the Avahi client when the poll loop stops (#5545)

SHA: e5759171f1db97aa9f39bc2ce77746f0b1d53497
Author: nikzasel <nikzasel@users.noreply.github.com>
Date: 2026-08-24 03:03
Parents: 233bb50
1 files changed +13 -1
Type
src/platform/linux/publish.cpp +13 −1
@@ -551,5 +551,7 @@
if (poll_thread.joinable()) {
poll_thread.join();
}
poll.reset();
}
};
@@ -581,6 +583,16 @@
return nullptr;
}
return std::make_unique<deinit_t>(std::jthread {[]() {
avahi::simple_poll_loop(poll.get());
return std::make_unique<deinit_t>(std::jthread {avahi::simple_poll_loop, poll.get()});
// simple_poll_loop() returns only once publishing has stopped for good: either at
// shutdown, or because a failure path called simple_poll_quit(). Nothing services the
// client's D-Bus connection past this point, so release it here rather than leave it
// open and subscribed until the process exits. The entry group is owned by the client,
// so clear it too, otherwise a later start() would reuse a dangling pointer.
client.reset();
group = nullptr;
}});
}
} // namespace platf::publish