Skip to content
Snippets Groups Projects
Commit 2385ed76 authored by Guillaume Desmottes's avatar Guillaume Desmottes
Browse files

turn-by-turn-service: expose the object *before* claiming the bus name


Claiming the well-known bus name should be done at the very least of the
service initialization so it's actually ready to be used when activated.

Signed-off-by: default avatarGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Reviewed-by: default avatarJustin Kim <justin.kim@collabora.com>
Differential Revision: https://phabricator.apertis.org/D5361
parent 6907dc30
No related branches found
No related tags found
No related merge requests found
......@@ -421,18 +421,9 @@ bus_name_acquired_cb (GDBusConnection *conn,
gpointer user_data)
{
TrpGuidanceTurnByTurnService *self = user_data;
GError *error = NULL;
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (self->service),
conn, TBT_PATH, &error))
{
fail_init_tasks (self, error);
}
else
{
self->registered = TRUE;
complete_init_tasks (self);
}
self->registered = TRUE;
complete_init_tasks (self);
}
static void
......@@ -459,6 +450,7 @@ trp_guidance_turn_by_turn_service_init_async (GAsyncInitable *initable,
TrpGuidanceTurnByTurnService *self = TRP_GUIDANCE_TURN_BY_TURN_SERVICE (initable);
g_autoptr (GTask) task = NULL;
gboolean start_init;
GError *error = NULL;
g_return_if_fail (self->conn != NULL);
......@@ -473,13 +465,22 @@ trp_guidance_turn_by_turn_service_init_async (GAsyncInitable *initable,
start_init = (self->init_tasks == NULL);
self->init_tasks = g_list_append (self->init_tasks, g_object_ref (task));
if (start_init)
self->own_name_id = g_bus_own_name_on_connection (self->conn,
TBT_BUS_NAME,
G_BUS_NAME_OWNER_FLAGS_NONE,
bus_name_acquired_cb,
bus_name_lost_cb, self,
NULL);
if (!start_init)
return;
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (self->service),
self->conn, TBT_PATH, &error))
{
fail_init_tasks (self, error);
return;
}
self->own_name_id = g_bus_own_name_on_connection (self->conn,
TBT_BUS_NAME,
G_BUS_NAME_OWNER_FLAGS_NONE,
bus_name_acquired_cb,
bus_name_lost_cb, self,
NULL);
}
static gboolean
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment