object-manager: wait until globals appear before emitting "installed"

object managers that are registered a bit early (such as the one in
wireplumber-cli) have no use if they are declared as installed before
any globals appear. After the initial registry startup, there should
be at least 1 global, the core (id=0), so even if this client has
no access to any object, the object manager should be able to
finish its installation successfully
This commit is contained in:
George Kiagiadakis 2020-05-13 19:24:29 +03:00
parent 27ff8d5ef2
commit 151480f3e4

View file

@ -770,11 +770,13 @@ wp_object_manager_maybe_objects_changed (WpObjectManager * self)
* - the registry does not have pending globals; these may be interesting
* to our object manager, so let's wait a bit until they are released
* and re-evaluate again later
* - the registry has globals; if we are on early startup where we don't
* have any globals yet, wait...
*/
else if (!self->installed) {
g_autoptr (WpCore) core = g_weak_ref_get (&self->core);
WpRegistry *reg = wp_core_get_registry (core);
if (reg->tmp_globals->len == 0) {
if (reg->tmp_globals->len == 0 && reg->globals->len != 0) {
wp_trace_object (self, "installed");
g_signal_emit (self, signals[SIGNAL_INSTALLED], 0);
self->installed = TRUE;