desktop/source/pkgchk/unopkg/unopkg_app.cxx | 21 ++++++++++++++++++--- desktop/source/pkgchk/unopkg/unopkg_misc.cxx | 7 +++---- desktop/source/pkgchk/unopkg/unopkg_shared.h | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-)
New commits: commit defbbe30f320922bda444e5a311df8e69f8716d5 Author: Samuel Mehrbrodt <[email protected]> AuthorDate: Mon Jan 20 11:12:12 2020 +0100 Commit: Samuel Mehrbrodt <[email protected]> CommitDate: Wed Feb 10 15:37:06 2021 +0100 tdf#129917 Use temp user profile when installing shared extensions Change-Id: I62dd163758e6348a62fc8a0b25150a62f282de90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86543 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <[email protected]> (cherry picked from commit c51a43bd70aa9fec0a051e51622a6a91f5aaa1a9) diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 35d2bee6f5c5..6064d1976aa1 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -31,6 +31,7 @@ #include <osl/process.h> #include <osl/conditn.hxx> #include <osl/file.hxx> +#include <unotools/tempfile.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/exc_hlp.hxx> #include <comphelper/anytostring.hxx> @@ -204,6 +205,7 @@ extern "C" int unopkg_main() Reference<XLogHandler> xFileHandler; Reference<XLogHandler> xConsoleHandler; std::unique_ptr<comphelper::EventLogger> logger; + std::unique_ptr<utl::TempFile> pUserProfileTempDir; OptionInfo const * info_shared = getOptionInfo( s_option_infos, "shared" ); @@ -298,8 +300,16 @@ extern "C" int unopkg_main() } } - xComponentContext = getUNO( - option_verbose, option_shared, subcmd_gui, xLocalComponentContext ); + // tdf#129917 Use temp user profile when installing shared extensions + if (option_shared) + { + pUserProfileTempDir.reset(new utl::TempFile(nullptr, true)); + pUserProfileTempDir->EnableKillingFile(); + } + + xComponentContext = getUNO(option_verbose, subcmd_gui, + pUserProfileTempDir ? pUserProfileTempDir->GetURL() : "", + xLocalComponentContext); // Initialize logging. This will log errors to the console and // also to file if the --log-file parameter was provided. @@ -359,7 +369,6 @@ extern "C" int unopkg_main() APP_NAME, toString(info_shared), toString(info_bundled)); return 1; } - } #endif diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index 6a11fdeae059..dcf77eb71602 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -416,13 +416,12 @@ static OUString getLockFilePath() } Reference<XComponentContext> getUNO( - bool verbose, bool shared, bool bGui, + bool verbose, bool bGui, const OUString& sTempDir, Reference<XComponentContext> & out_localContext) { // do not create any user data (for the root user) in --shared mode: - if (shared) { - rtl::Bootstrap::set("CFG_CacheUrl", OUString()); - } + if (!sTempDir.isEmpty()) + rtl::Bootstrap::set("UserInstallation", sTempDir); // hold lock during process runtime: static ::desktop::Lockfile s_lockfile( false /* no IPC server */ ); diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h index 6d23b4c8f39e..68a46227314e 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_shared.h +++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h @@ -109,7 +109,7 @@ void printf_packages( css::uno::Reference<css::uno::XComponentContext> getUNO( - bool verbose, bool shared, bool bGui, + bool verbose, bool bGui, const OUString& sTempDir, css::uno::Reference<css::uno::XComponentContext> & out_LocalComponentContext); } commit 777551b86a560cd8e45877cbb16075a940314866 Author: Stephan Bergmann <[email protected]> AuthorDate: Tue Jan 28 10:39:16 2020 +0100 Commit: Samuel Mehrbrodt <[email protected]> CommitDate: Wed Feb 10 15:32:19 2021 +0100 Dispose configmgr at the end of unopkg ...so that the configmgr::Components::WriteThread (configmgr/source/components.cxx) is joined well before exit. (This should solve the issue discussed at <https://gerrit.libreoffice.org/c/core/+/86543/3/ configmgr/source/writemodfile.cxx#564>, "tdf#129917 Use temp user profile when installing shared extensions".) Change-Id: I79004c2e7f839d80eda23eed2a1c5e8e660a58df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87592 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> (cherry picked from commit 9f277b2616512299ec20de0209c272527f26386b) diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index f6e4d0c19b7c..35d2bee6f5c5 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -590,6 +590,8 @@ extern "C" int unopkg_main() logger->log(LogLevel::INFO, "$1$ done.", APP_NAME); //Force to release all bridges which connect us to the child processes dp_misc::disposeBridges(xLocalComponentContext); + css::uno::Reference<css::lang::XComponent>( + xLocalComponentContext, css::uno::UNO_QUERY_THROW)->dispose(); return 0; } catch (const ucb::CommandFailedException &e) @@ -621,6 +623,10 @@ extern "C" int unopkg_main() if (!bNoOtherErrorMsg) logger->log(LogLevel::SEVERE, "$1$ failed.", APP_NAME); dp_misc::disposeBridges(xLocalComponentContext); + if (xLocalComponentContext.is()) { + css::uno::Reference<css::lang::XComponent>( + xLocalComponentContext, css::uno::UNO_QUERY_THROW)->dispose(); + } return 1; } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
