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 <smcv@collabora.com>
This commit is contained in:
Simon McVittie
2021-04-15 19:23:47 +01:00
committed by Alexander Larsson
parent cb47d83b72
commit a89aa1442a

View File

@@ -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;