gdbusnameowning: Subscribe to NameLost before calling RequestName
There was a slight race in name ownership: a gap between calling
RequestName
(or receiving its reply) and subscribing to NameLost
. In
that gap, another process could request and receive the name, and this
one wouldn’t know about it.
Fix that by subscribing to NameAcquired
and NameLost
before calling
RequestName
, and then unsubscribing again if the subscriptions turn
out not to be necessary (if the process can’t own the requested name).
Spotted and diagnosed by Miika Karanki.
One of the tests needs an additional iteration of the main loop in order to free all the signal closures before it can complete its checks.
Signed-off-by: Philip Withnall withnall@endlessm.com
Fixes: #1517 (closed)
Edited by Philip Withnall