desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx | 72 ++++------- 1 file changed, 30 insertions(+), 42 deletions(-)
New commits: commit f3e1fe1b71bd3948b3778999acedc8202032b616 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Jul 23 08:49:27 2025 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Jul 23 11:23:38 2025 +0200 There is no compelling reason for this `using` here dp_misc namespace is spelled elsewhere, and omitting it in one place doesn't seem to simplify a thing. Change-Id: I361cd14089abf23f6bfc5b5e8a4b85b1aa919177 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188198 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx index ad5fe04601a5..abd85d67a50c 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx @@ -58,7 +58,6 @@ #include <string_view> #include <vector> -using dp_misc::StrTitle; namespace dp_gui { class UpdateCommandEnv @@ -551,7 +550,7 @@ bool UpdateInstallDialog::Thread::download(OUString const & sDownloadURL, Update ::ucbhelper::Content sourceContent; (void)dp_misc::create_ucb_content(&sourceContent, sDownloadURL, m_updateCmdEnv); - OUString sTitle(StrTitle::getTitle(sourceContent)); + OUString sTitle(dp_misc::StrTitle::getTitle(sourceContent)); if (sTitle.indexOf('.') < 0) { // The title could be changed due to redirection (seen with github URLs, which arrive commit ec8360999dfc1af5d03503051fbab03da03d8cc9 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Jul 23 08:39:44 2025 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Jul 23 11:23:31 2025 +0200 UpdateCommandEnv doesn't need a reference to parent thread There is a situation of mutual reference holding, resolved currently in the end of the thread's execute(). But there is no dependency in UpdateCommandEnv, which would justify holding the thread's reference in it. Change-Id: I5702551e2acc0eb8988898d8d62456fcede81873 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188197 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx index 84f1b5f5ec57..ad5fe04601a5 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx @@ -59,12 +59,35 @@ #include <vector> using dp_misc::StrTitle; -namespace dp_gui { class UpdateCommandEnv; }; - namespace dp_gui { +class UpdateCommandEnv + : public ::cppu::WeakImplHelper< css::ucb::XCommandEnvironment, + css::task::XInteractionHandler, + css::ucb::XProgressHandler > +{ + css::uno::Reference< css::uno::XComponentContext > m_xContext; + +public: + UpdateCommandEnv(css::uno::Reference<css::uno::XComponentContext> xCtx); + + // XCommandEnvironment + virtual css::uno::Reference<css::task::XInteractionHandler > SAL_CALL + getInteractionHandler() override; + virtual css::uno::Reference<css::ucb::XProgressHandler > + SAL_CALL getProgressHandler() override; + + // XInteractionHandler + virtual void SAL_CALL handle( + css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) override; + + // XProgressHandler + virtual void SAL_CALL push( css::uno::Any const & Status ) override; + virtual void SAL_CALL update( css::uno::Any const & Status ) override; + virtual void SAL_CALL pop() override; +}; + class UpdateInstallDialog::Thread: public salhelper::Thread { - friend class UpdateCommandEnv; public: Thread(css::uno::Reference< css::uno::XComponentContext > const & ctx, UpdateInstallDialog & dialog, std::vector< dp_gui::UpdateData > & aVecUpdateData); @@ -95,36 +118,6 @@ private: }; -class UpdateCommandEnv - : public ::cppu::WeakImplHelper< css::ucb::XCommandEnvironment, - css::task::XInteractionHandler, - css::ucb::XProgressHandler > -{ - friend class UpdateInstallDialog::Thread; - - ::rtl::Reference<UpdateInstallDialog::Thread> m_installThread; - css::uno::Reference< css::uno::XComponentContext > m_xContext; - -public: - UpdateCommandEnv( css::uno::Reference< css::uno::XComponentContext > xCtx, - ::rtl::Reference<UpdateInstallDialog::Thread> thread); - - // XCommandEnvironment - virtual css::uno::Reference<css::task::XInteractionHandler > SAL_CALL - getInteractionHandler() override; - virtual css::uno::Reference<css::ucb::XProgressHandler > - SAL_CALL getProgressHandler() override; - - // XInteractionHandler - virtual void SAL_CALL handle( - css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) override; - - // XProgressHandler - virtual void SAL_CALL push( css::uno::Any const & Status ) override; - virtual void SAL_CALL update( css::uno::Any const & Status ) override; - virtual void SAL_CALL pop() override; -}; - UpdateInstallDialog::Thread::Thread( css::uno::Reference< css::uno::XComponentContext> const & xCtx, @@ -134,7 +127,7 @@ UpdateInstallDialog::Thread::Thread( m_dialog(dialog), m_xComponentContext(xCtx), m_aVecUpdateData(aVecUpdateData), - m_updateCmdEnv(new UpdateCommandEnv(xCtx, this)), + m_updateCmdEnv(new UpdateCommandEnv(xCtx)), m_stop(false) {} @@ -174,8 +167,6 @@ void UpdateInstallDialog::Thread::execute() if (! m_stop) m_dialog.updateDone(); } - //UpdateCommandEnv keeps a reference to Thread and prevents destruction. Therefore remove it. - m_updateCmdEnv->m_installThread.clear(); } UpdateInstallDialog::UpdateInstallDialog( @@ -592,10 +583,8 @@ bool UpdateInstallDialog::Thread::download(OUString const & sDownloadURL, Update return m_stop; } -UpdateCommandEnv::UpdateCommandEnv( css::uno::Reference< css::uno::XComponentContext > xCtx, - ::rtl::Reference<UpdateInstallDialog::Thread> thread) - : m_installThread(std::move(thread)), - m_xContext(std::move(xCtx)) +UpdateCommandEnv::UpdateCommandEnv(css::uno::Reference<css::uno::XComponentContext> xCtx) + : m_xContext(std::move(xCtx)) { }