diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2020-10-04 12:24:20 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2020-10-04 12:32:55 +0200 |
commit | a27a18bbc583ef8095cd73d9571a6bf7af7140a3 (patch) | |
tree | 7d1fcf186502f5c72d9bc8a39e747ab9867886e8 /src/portal/tracker-main.c | |
parent | db1b17576f5e1edc4f145a73a9c873d453717f81 (diff) | |
download | tracker-a27a18bbc583ef8095cd73d9571a6bf7af7140a3.tar.gz |
portal: Fix initialization orderwip/carlosg/portal-initialization
The portal is currently first claiming the bus name, then adding
the portal object+interface. This may break things with autostart
as clients are able to send a message to an object path that is not
there yet.
Changing the order means the object path is there when the DBus name
is made known, so clients are able to talk immediately to it.
Fixes the error reported at
https://github.com/flathub/org.gnome.Music/pull/24#issuecomment-702565846
Diffstat (limited to 'src/portal/tracker-main.c')
-rw-r--r-- | src/portal/tracker-main.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/portal/tracker-main.c b/src/portal/tracker-main.c index e8977fc4b..8c0429c76 100644 --- a/src/portal/tracker-main.c +++ b/src/portal/tracker-main.c @@ -76,7 +76,6 @@ name_acquired_callback (GDBusConnection *connection, gpointer user_data) { g_debug ("Name '%s' acquired", name); - g_main_loop_quit (user_data); } static void @@ -123,23 +122,20 @@ main (int argc, char *argv[]) return EXIT_FAILURE; } - main_loop = g_main_loop_new (NULL, FALSE); + portal = tracker_portal_new (connection, NULL, &error); + if (!portal) { + g_printerr ("%s", error->message); + return EXIT_FAILURE; + } g_bus_own_name_on_connection (connection, "org.freedesktop.portal.Tracker", G_BUS_NAME_OWNER_FLAGS_NONE, name_acquired_callback, name_lost_callback, - g_main_loop_ref (main_loop), - (GDestroyNotify) g_main_loop_unref); + NULL, NULL); - g_main_loop_run (main_loop); - - portal = tracker_portal_new (connection, NULL, &error); - if (!portal) { - g_printerr ("%s", error->message); - return EXIT_FAILURE; - } + main_loop = g_main_loop_new (NULL, FALSE); g_unix_signal_add (SIGINT, sigterm_cb, main_loop); g_unix_signal_add (SIGTERM, sigterm_cb, main_loop); |