pulse-server: add context listener last

Add if after we have done everything else because if there is an
error we don't remove it and there will be an invalid hook registered
in the context.
This commit is contained in:
Wim Taymans 2021-06-16 10:33:32 +02:00
parent 22bb2666c4
commit f43c57afdb

View file

@ -6665,9 +6665,6 @@ struct pw_protocol_pulse *pw_protocol_pulse_new(struct pw_context *context,
spa_list_init(&impl->cleanup_clients); spa_list_init(&impl->cleanup_clients);
spa_list_init(&impl->free_messages); spa_list_init(&impl->free_messages);
pw_context_add_listener(context, &impl->context_listener,
&context_events, impl);
str = pw_properties_get(props, "server.address"); str = pw_properties_get(props, "server.address");
if (str == NULL) { if (str == NULL) {
pw_properties_setf(props, "server.address", pw_properties_setf(props, "server.address",
@ -6690,6 +6687,8 @@ struct pw_protocol_pulse *pw_protocol_pulse_new(struct pw_context *context,
pw_log_warn(NAME" %p: can't create pid file: %s", pw_log_warn(NAME" %p: can't create pid file: %s",
impl, spa_strerror(res)); impl, spa_strerror(res));
} }
pw_context_add_listener(context, &impl->context_listener,
&context_events, impl);
impl->dbus_name = dbus_request_name(context, "org.pulseaudio.Server"); impl->dbus_name = dbus_request_name(context, "org.pulseaudio.Server");