File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -551,6 +551,8 @@ namespace platf::publish {
551551 if (poll_thread.joinable ()) {
552552 poll_thread.join ();
553553 }
554+
555+ poll.reset ();
554556 }
555557 };
556558
@@ -581,6 +583,16 @@ namespace platf::publish {
581583 return nullptr ;
582584 }
583585
584- return std::make_unique<deinit_t >(std::jthread {avahi::simple_poll_loop, poll.get ()});
586+ return std::make_unique<deinit_t >(std::jthread {[]() {
587+ avahi::simple_poll_loop (poll.get ());
588+
589+ // simple_poll_loop() returns only once publishing has stopped for good: either at
590+ // shutdown, or because a failure path called simple_poll_quit(). Nothing services the
591+ // client's D-Bus connection past this point, so release it here rather than leave it
592+ // open and subscribed until the process exits. The entry group is owned by the client,
593+ // so clear it too, otherwise a later start() would reuse a dangling pointer.
594+ client.reset ();
595+ group = nullptr ;
596+ }});
585597 }
586598} // namespace platf::publish
You can’t perform that action at this time.
0 commit comments