diff options
author | Justin Luth <jluth@mail.com> | 2024-01-02 14:20:29 -0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-01-03 05:51:57 +0100 |
commit | 4963fc47a0381967246e15479bf79bb58dddc465 (patch) | |
tree | 9233d8c0d9959876d73f84899e760976107ad915 /desktop | |
parent | 960e37af28807ed1b376e26c4504ab755a81dfd5 (diff) |
tdf117100: do not attempt to re-install extensions on restart
A common way to install extensions is to simply double-click
on them in the OS's file browser. But in this case the reload
still contains the extension in the cmdline and thus it
"opens" the extension again and asks to re-install.
So just eliminate OXTs from the commandline if OfficeRestartInProgress.
If multiple OXTs are provided on the commandline, two things happen:
-LO crashes (with an assert)
-both extensions are successfully installed before restart is requested.
In both cases removing ALL extensions during restart is appropriate.
Prior to this patch, OfficeRestartInProgress was not actually used AFAICS.
Mike Kaganski laid out lots of good criteria for this patch
1. After restart, user can still manually install an extension: YES
2. A restart after a restart should still inhibit extensions: YES
3. Must no interfere is user choses to "restart later": YES
4. It works with a clean profile (rm -r instdir/user): YES
This implementation is closest to his suggested
> Variant 4. Cleanup all fileopen/print arguments from the guards
> that manage restarts (e.g., soffice.exe on Windows), so that
> when restarting, they would not repeat using those arguments again.
> Problem: first launch of soffice.bin that initializes user profile:
> restart after this should repeat all the command line arguments.
Change-Id: I2460cb31be0c6f3e10cbb5b200cf67839cbd822a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161549
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/app.cxx | 7 | ||||
-rw-r--r-- | desktop/source/app/cmdlineargs.cxx | 5 | ||||
-rw-r--r-- | desktop/source/app/cmdlineargs.hxx | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 0d66a48daac7..370fc5761553 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -478,6 +478,13 @@ void Desktop::Init() // the UserConfiguration directory comphelper::BackupFileHelper::reactOnSafeMode(Application::IsSafeModeEnabled()); + // tdf117100: do not try to re-install extensions after the requested restart + if (officecfg::Setup::Office::OfficeRestartInProgress::get()) + { + if (!officecfg::Office::Common::Misc::FirstRun::get()) + GetCommandLineArgs().RemoveFilesFromOpenListEndingWith(".oxt"); + } + try { if (!langselect::prepareLocale()) diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx index e7f315204048..f96814e8e7ff 100644 --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -736,6 +736,11 @@ bool CommandLineArgs::HasModuleParam() const || m_web || m_base; } +void CommandLineArgs::RemoveFilesFromOpenListEndingWith(const OUString& rExt) +{ + std::erase_if(m_openlist, [rExt](OUString url) { return url.endsWithIgnoreAsciiCase(rExt); }); +} + std::vector< OUString > CommandLineArgs::GetOpenList() const { return translateExternalUris(m_openlist); diff --git a/desktop/source/app/cmdlineargs.hxx b/desktop/source/app/cmdlineargs.hxx index 64a1bcfd0ccb..a9eca1d980f1 100644 --- a/desktop/source/app/cmdlineargs.hxx +++ b/desktop/source/app/cmdlineargs.hxx @@ -99,6 +99,7 @@ class CommandLineArgs bool HasSplashPipe() const { return m_splashpipe;} std::vector< OUString > const & GetAccept() const { return m_accept;} std::vector< OUString > const & GetUnaccept() const { return m_unaccept;} + void RemoveFilesFromOpenListEndingWith(const OUString& rExt); std::vector< OUString > GetOpenList() const; std::vector< OUString > GetViewList() const; std::vector< OUString > GetStartList() const; |