Skip to content

Commit 881f0d5

Browse files
ComixHereddevillg
authored andcommitted
refactor: move gvfs envs to OstreeRepo ctor
ensure that gvfs module wouldn't be loaded Signed-off-by: ComixHe <ComixHe1895@outlook.com>
1 parent ec90115 commit 881f0d5

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

apps/ll-builder/src/main.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -968,14 +968,6 @@ You can report bugs to the linyaps team under this project: https://github.com/O
968968
return -1;
969969
}
970970

971-
// To avoid glib start thread
972-
// set GIO_USE_VFS to local and GVFS_REMOTE_VOLUME_MONITOR_IGNORE to 1
973-
auto gioGuard =
974-
std::make_unique<linglong::utils::command::EnvironmentVariableGuard>("GIO_USE_VFS", "local");
975-
auto gvfsGuard = std::make_unique<linglong::utils::command::EnvironmentVariableGuard>(
976-
"GVFS_REMOTE_VOLUME_MONITOR_IGNORE",
977-
"1");
978-
979971
auto result = linglong::repo::tryMigrate(builderCfg->repo, *repoCfg);
980972
if (result == linglong::repo::MigrateResult::Failed) {
981973
if (!backupFailedMigrationRepo(builderCfg->repo)) {
@@ -993,10 +985,6 @@ You can report bugs to the linyaps team under this project: https://github.com/O
993985

994986
linglong::repo::OSTreeRepo repo(repoRoot, *repoCfg, clientFactory);
995987

996-
// restore to original value
997-
gioGuard.reset();
998-
gvfsGuard.reset();
999-
1000988
if (buildRepo->parsed()) {
1001989
return handleRepo(repo,
1002990
repoCmdOpts,

libs/linglong/src/linglong/repo/ostree_repo.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,14 @@ OSTreeRepo::OSTreeRepo(const QDir &path,
749749
qFatal("%s", msg.c_str());
750750
}
751751

752+
// To avoid glib start thread
753+
// set GIO_USE_VFS to local and GVFS_REMOTE_VOLUME_MONITOR_IGNORE to 1
754+
linglong::utils::command::EnvironmentVariableGuard gioGuard{ "GIO_USE_VFS", "local" };
755+
linglong::utils::command::EnvironmentVariableGuard gvfsGuard{
756+
"GVFS_REMOTE_VOLUME_MONITOR_IGNORE",
757+
"1"
758+
};
759+
752760
g_autoptr(GError) gErr = nullptr;
753761
g_autoptr(GFile) repoPath = nullptr;
754762
g_autoptr(OstreeRepo) ostreeRepo = nullptr;

0 commit comments

Comments
 (0)