summaryrefslogtreecommitdiff
path: root/registryd
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2022-11-07 19:06:12 -0600
committerFederico Mena Quintero <federico@gnome.org>2022-11-07 19:06:12 -0600
commit65e2f4e6b30b121c750c6d751c9e78211daf48ab (patch)
treeb8da8696a5123b48b08ecb2fae39feec6231ee23 /registryd
parent4007b22aac8077862e12b29f23b1834a610e289a (diff)
downloadat-spi2-core-65e2f4e6b30b121c750c6d751c9e78211daf48ab.tar.gz
call_set_id() - take the application's id as an argument
Don't pull it out of the registry right there. This also moves the responsibility for incrementing the current id to the caller.
Diffstat (limited to 'registryd')
-rw-r--r--registryd/registry.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/registryd/registry.c b/registryd/registry.c
index facbf9be..e4d7b5da 100644
--- a/registryd/registry.c
+++ b/registryd/registry.c
@@ -209,7 +209,7 @@ add_application (SpiRegistry *registry, SpiReference *app_root)
}
static void
-call_set_id (SpiRegistry *registry, SpiReference *app)
+call_set_id (SpiRegistry *registry, SpiReference *app, dbus_int32_t id)
{
DBusMessage *message;
DBusMessageIter iter, iter_variant;
@@ -224,9 +224,7 @@ call_set_id (SpiRegistry *registry, SpiReference *app)
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &iface_application);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &id_str);
dbus_message_iter_open_container (&iter, DBUS_TYPE_VARIANT, "i", &iter_variant);
- dbus_message_iter_append_basic (&iter_variant, DBUS_TYPE_INT32, &registry->id);
- /* TODO: This will cause problems if we cycle through 2^31 ids */
- registry->id++;
+ dbus_message_iter_append_basic (&iter_variant, DBUS_TYPE_INT32, &id);
dbus_message_iter_close_container (&iter, &iter_variant);
dbus_connection_send (registry->bus, message, NULL);
dbus_message_unref (message);
@@ -440,7 +438,9 @@ static SpiReference *
socket_embed (SpiRegistry *registry, SpiReference *app_root)
{
add_application (registry, app_root);
- call_set_id (registry, app_root);
+ call_set_id (registry, app_root, registry->id);
+ /* TODO: This will cause problems if we cycle through 2^31 ids */
+ registry->id++;
return spi_reference_new (registry->bus_unique_name, SPI_DBUS_PATH_ROOT);
}