summaryrefslogtreecommitdiff
path: root/document-portal
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2015-09-08 14:23:27 +0200
committerAlexander Larsson <alexl@redhat.com>2015-09-08 14:23:27 +0200
commitaf331d364f5c3faf0082d99b4f69f29485335252 (patch)
tree1d099154fd1b96e1909fbc3e467f913f09a028f8 /document-portal
parentbbc6fa88354e1cdd722479e83520bb0f8a3861cf (diff)
downloadxdg-app-af331d364f5c3faf0082d99b4f69f29485335252.tar.gz
document portal: Move locking explicitly into portal handlers
This is requires because do i/o on the passed in fd in add() and if you pass in a fd on the fuse mount itself we deadlock.
Diffstat (limited to 'document-portal')
-rw-r--r--document-portal/xdp-main.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/document-portal/xdp-main.c b/document-portal/xdp-main.c
index 58ca742..6b64f57 100644
--- a/document-portal/xdp-main.c
+++ b/document-portal/xdp-main.c
@@ -124,6 +124,8 @@ portal_grant_permissions (GDBusMethodInvocation *invocation,
g_variant_get (parameters, "(&s&s^a&s)", &id, &target_app_id, &permissions);
+ AUTOLOCK(db);
+
entry = xdg_app_db_lookup (db, id);
if (entry == NULL)
{
@@ -169,6 +171,8 @@ portal_revoke_permissions (GDBusMethodInvocation *invocation,
g_variant_get (parameters, "(&s&s^a&s)", &id, &target_app_id, &permissions);
+ AUTOLOCK(db);
+
entry = xdg_app_db_lookup (db, id);
if (entry == NULL)
{
@@ -214,6 +218,8 @@ portal_delete (GDBusMethodInvocation *invocation,
g_variant_get (parameters, "(s)", &id);
+ AUTOLOCK(db);
+
entry = xdg_app_db_lookup (db, id);
if (entry == NULL)
{
@@ -375,6 +381,8 @@ portal_add (GDBusMethodInvocation *invocation,
return;
}
+ AUTOLOCK(db);
+
id = do_create_doc (&real_parent_st_buf, path_buffer, reuse_existing);
if (app_id[0] != '\0')
@@ -417,10 +425,7 @@ got_app_id_cb (GObject *source_object,
if (app_id == NULL)
g_dbus_method_invocation_return_gerror (invocation, error);
else
- {
- AUTOLOCK(db);
- portal_method (invocation, g_dbus_method_invocation_get_parameters (invocation), app_id);
- }
+ portal_method (invocation, g_dbus_method_invocation_get_parameters (invocation), app_id);
}
static gboolean