desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx |   11 +++++------
 desktop/source/deployment/gui/dp_gui_updatedialog.cxx      |   10 +++-------
 desktop/source/deployment/gui/dp_gui_updatedialog.hxx      |   11 +++++------
 3 files changed, 13 insertions(+), 19 deletions(-)

New commits:
commit 674095031ddf8848f18a10b4d187927694bb3a5c
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Nov 10 12:56:16 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon Nov 10 23:11:37 2025 +0100

    extension mgr: Let UpdateDialog own its UpdateData
    
    Instead of passing an empty vector in the ctor
    and hold that by reference, have a vector owned
    by UpdateDialog, and add a getter to make it
    available from outside.
    
    Change-Id: Id9a0faeb6857acf1e10fc0fb4d61692409872c18
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193746
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx 
b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index ec8a2db720e8..ed717f0cd321 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -905,22 +905,21 @@ void ExtensionCmdQueue::Thread::_checkForUpdates(
 
     m_rDialogHelper.incBusy();
 
-    std::vector< UpdateData > vData;
-    UpdateDialog aUpdateDialog(m_xContext, m_rDialogHelper.getDialog(),
-                               std::move(vExtensionList), &vData);
+    UpdateDialog aUpdateDialog(m_xContext, m_rDialogHelper.getDialog(), 
std::move(vExtensionList));
 
     aUpdateDialog.notifyMenubar( true, false ); // prepare the checking, if 
there updates to be notified via menu bar icon
 
     bool bOk = aUpdateDialog.run() == RET_OK;
     m_rDialogHelper.decBusy();
 
-    if (bOk && !vData.empty())
+    const std::vector<UpdateData>& rUpdateData = aUpdateDialog.getUpdateData();
+    if (bOk && !rUpdateData.empty())
     {
         // If there is at least one directly downloadable extension then we
         // open the install dialog.
         std::vector< UpdateData > dataDownload;
 
-        for (auto const& data : vData)
+        for (auto const& data : rUpdateData)
         {
             if ( data.sWebsiteURL.isEmpty() )
                 dataDownload.push_back(data);
@@ -941,7 +940,7 @@ void ExtensionCmdQueue::Thread::_checkForUpdates(
         //Now start the webbrowser and navigate to the websites where we get 
the updates
         if ( RET_OK == nDialogResult )
         {
-            for (auto const& data : vData)
+            for (auto const& data : rUpdateData)
             {
                 if (!data.sWebsiteURL.isEmpty())
                     m_rDialogHelper.openWebBrowser(data.sWebsiteURL,
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx 
b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 994d1f1c38e0..4d218539fbc5 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -415,10 +415,9 @@ bool UpdateDialog::Thread::update(
 }
 
 // UpdateDialog ----------------------------------------------------------
-UpdateDialog::UpdateDialog(
-    uno::Reference< uno::XComponentContext > const & context,
-    weld::Window * parent, std::vector<uno::Reference< deployment::XPackage > 
> && vExtensionList,
-    std::vector< dp_gui::UpdateData > * updateData)
+UpdateDialog::UpdateDialog(uno::Reference<uno::XComponentContext> const& 
context,
+                           weld::Window* parent,
+                           std::vector<uno::Reference<deployment::XPackage>>&& 
vExtensionList)
     : GenericDialogController(parent, u"desktop/ui/updatedialog.ui"_ustr, 
u"UpdateDialog"_ustr)
     , m_context(context)
     , m_none(DpResId(RID_DLG_UPDATE_NONE))
@@ -432,7 +431,6 @@ UpdateDialog::UpdateDialog(
     , m_browserbased(DpResId(RID_DLG_UPDATE_BROWSERBASED))
     , m_version(DpResId(RID_DLG_UPDATE_VERSION))
     , m_ignoredUpdate(DpResId(RID_DLG_UPDATE_IGNORED_UPDATE))
-    , m_updateData(*updateData)
     , m_thread(new UpdateDialog::Thread(context, *this, 
std::move(vExtensionList)))
     , m_xChecking(m_xBuilder->weld_label(u"UPDATE_CHECKING"_ustr))
     , m_xThrobber(m_xBuilder->weld_spinner(u"THROBBER"_ustr))
@@ -456,8 +454,6 @@ UpdateDialog::UpdateDialog(
 
     m_xUpdates->enable_toggle_buttons(weld::ColumnToggleType::Check);
 
-    OSL_ASSERT(updateData != nullptr);
-
     m_xExtensionManager = deployment::ExtensionManager::get( context );
 
     m_xUpdates->connect_selection_changed(LINK(this, UpdateDialog, 
selectionHandler));
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx 
b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
index c04c29f0dc19..2e11c2b590f2 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
@@ -63,11 +63,9 @@ public:
        one with the highest version must be used, because it contains the 
latest known update
        information.
     */
-    UpdateDialog(
-        css::uno::Reference< css::uno::XComponentContext > const & context,
-        weld::Window * parent,
-        std::vector< css::uno::Reference< css::deployment::XPackage > > && 
vExtensionList,
-        std::vector< dp_gui::UpdateData > * updateData);
+    UpdateDialog(css::uno::Reference<css::uno::XComponentContext> const& 
context,
+                 weld::Window* parent,
+                 std::vector<css::uno::Reference<css::deployment::XPackage>>&& 
vExtensionList);
 
     virtual ~UpdateDialog() override;
 
@@ -76,6 +74,7 @@ public:
     void notifyMenubar( bool bPrepareOnly, bool bRecheckOnly );
     static void createNotifyJob( bool bPrepareOnly,
         css::uno::Sequence< css::uno::Sequence< OUString > > const &rItemList 
);
+    const std::vector<dp_gui::UpdateData>& getUpdateData() { return 
m_updateData; }
 
 private:
     UpdateDialog(UpdateDialog const &) = delete;
@@ -138,7 +137,7 @@ private:
     std::vector< UpdateDialog::SpecificError > m_specificErrors;
     std::vector< std::unique_ptr<UpdateDialog::IgnoredUpdate> > 
m_ignoredUpdates;
     std::vector< std::unique_ptr<Index> > m_ListboxEntries;
-    std::vector< dp_gui::UpdateData > & m_updateData;
+    std::vector<dp_gui::UpdateData> m_updateData;
     rtl::Reference< UpdateDialog::Thread > m_thread;
     css::uno::Reference< css::deployment::XExtensionManager > 
m_xExtensionManager;
 

Reply via email to