From a89aa1442a7cb4f151b63c68cf64172bb4c29798 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 15 Apr 2021 19:23:47 +0100 Subject: [PATCH] run: Delay allocation of per-app directory If we call this after flatpak_run_add_app_info_args(), then the garbage-collection code will have a chance to run, cleaning up after a previous instance of the same app. In a previous implementation of #4093 that also implemented #4120, we had to allocate the per-app directory this early to avoid shadowing the XDG_RUNTIME_DIR allocated in flatpak_run_add_app_info_args(), but I'm taking a different approach to that now. Signed-off-by: Simon McVittie --- common/flatpak-run.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/common/flatpak-run.c b/common/flatpak-run.c index 52fd9854..ef498e90 100644 --- a/common/flatpak-run.c +++ b/common/flatpak-run.c @@ -4220,15 +4220,6 @@ flatpak_run_app (FlatpakDecomposed *app_ref, flags |= flatpak_context_get_run_flags (app_context); - if (!sandboxed) - { - if (!flatpak_instance_ensure_per_app_dir (app_id, - &per_app_dir_lock_fd, - &per_app_dir_lock_path, - error)) - return FALSE; - } - if (!flatpak_run_setup_base_argv (bwrap, runtime_files, app_id_dir, app_arch, flags, error)) return FALSE; @@ -4256,6 +4247,15 @@ flatpak_run_app (FlatpakDecomposed *app_ref, error)) return FALSE; + if (!sandboxed) + { + if (!flatpak_instance_ensure_per_app_dir (app_id, + &per_app_dir_lock_fd, + &per_app_dir_lock_path, + error)) + return FALSE; + } + if (!flatpak_run_add_dconf_args (bwrap, app_id, metakey, error)) return FALSE;