lib: Make sure we always call flatpak_dir_ensure_repo after cloning the dir

Otherwise we're not guaranteed the new FlatpakDir has a repo.
This commit is contained in:
Alexander Larsson
2016-08-29 16:11:48 +02:00
parent 59040b50f2
commit aa160aa111

View File

@@ -1003,6 +1003,8 @@ flatpak_installation_install_bundle (FlatpakInstallation *self,
/* Pull, prune, etc are not threadsafe, so we work on a copy */
dir_clone = flatpak_dir_clone (dir);
if (flatpak_dir_ensure_repo (dir_clone, cancellable, error))
return NULL;
if (!flatpak_dir_install_bundle (dir_clone, file, NULL, &ref,
cancellable, error))
@@ -1071,6 +1073,8 @@ flatpak_installation_install_full (FlatpakInstallation *self,
/* Pull, prune, etc are not threadsafe, so we work on a copy */
dir_clone = flatpak_dir_clone (dir);
if (flatpak_dir_ensure_repo (dir_clone, cancellable, error))
return NULL;
/* Work around ostree-pull spinning the default main context for the sync calls */
main_context = g_main_context_new ();
@@ -1195,6 +1199,8 @@ flatpak_installation_update_full (FlatpakInstallation *self,
/* Pull, prune, etc are not threadsafe, so we work on a copy */
dir_clone = flatpak_dir_clone (dir);
if (flatpak_dir_ensure_repo (dir_clone, cancellable, error))
return NULL;
/* Work around ostree-pull spinning the default main context for the sync calls */
main_context = g_main_context_new ();
@@ -1299,6 +1305,8 @@ flatpak_installation_uninstall (FlatpakInstallation *self,
/* prune, etc are not threadsafe, so we work on a copy */
dir_clone = flatpak_dir_clone (dir);
if (flatpak_dir_ensure_repo (dir_clone, cancellable, error))
return FALSE;
if (!flatpak_dir_uninstall (dir_clone, ref, FLATPAK_HELPER_UNINSTALL_FLAGS_NONE,
cancellable, error))
@@ -1520,6 +1528,8 @@ flatpak_installation_update_appstream_sync (FlatpakInstallation *self,
/* Pull, prune, etc are not threadsafe, so we work on a copy */
dir_clone = flatpak_dir_clone (dir);
if (flatpak_dir_ensure_repo (dir_clone, cancellable, error))
return FALSE;
if (main_context)
g_main_context_pop_thread_default (main_context);