extensions/source/propctrlr/listselectiondlg.cxx |   11 ++++++-----
 extensions/source/propctrlr/listselectiondlg.hxx |    2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit bd0d3b460fe9d4aaaf2cefb78ff7dd85423b6066
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu May 22 14:03:04 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu May 22 22:43:43 2025 +0200

    Resolves: tdf#166613 wrong selection returned from forms listbox editor
    
    Change-Id: I14e51eb1945d282691275f394bfbac50f3c4cc48
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185666
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/extensions/source/propctrlr/listselectiondlg.cxx 
b/extensions/source/propctrlr/listselectiondlg.cxx
index edbc97a93cf7..22e0f746e518 100644
--- a/extensions/source/propctrlr/listselectiondlg.cxx
+++ b/extensions/source/propctrlr/listselectiondlg.cxx
@@ -95,8 +95,7 @@ namespace pcr
         if ( !m_xListBox.is() )
             return;
 
-        std::vector< sal_Int16 > aSelection;
-        collectSelection( aSelection );
+        std::vector<sal_Int16> aSelection(collectSelection());
 
         try
         {
@@ -117,12 +116,14 @@ namespace pcr
         m_xEntries->thaw();
     }
 
-    void ListSelectionDialog::collectSelection( std::vector< sal_Int16 >& /* 
[out] */ _rSelection )
+    std::vector<sal_Int16> ListSelectionDialog::collectSelection() const
     {
+        std::vector<sal_Int16> aRetSelection;
         auto aSelection = m_xEntries->get_selected_rows();
-        _rSelection.resize(aSelection.size());
+        aRetSelection.reserve(aSelection.size());
         for (auto row : aSelection)
-            _rSelection.push_back(row);
+            aRetSelection.push_back(row);
+        return aRetSelection;
     }
 
     void ListSelectionDialog::selectEntries( const Sequence< sal_Int16 >& /* 
[in ] */ _rSelection )
diff --git a/extensions/source/propctrlr/listselectiondlg.hxx 
b/extensions/source/propctrlr/listselectiondlg.hxx
index 368e9e9aac94..8a1f5a15218c 100644
--- a/extensions/source/propctrlr/listselectiondlg.hxx
+++ b/extensions/source/propctrlr/listselectiondlg.hxx
@@ -51,7 +51,7 @@ namespace pcr
         void    fillEntryList   ( const css::uno::Sequence< OUString >& 
_rListEntries );
 
         void    selectEntries   ( const css::uno::Sequence< sal_Int16 >& /* 
[in ] */ _rSelection );
-        void    collectSelection(       std::vector< sal_Int16 >& /* [out] */ 
_rSelection );
+        std::vector<sal_Int16> collectSelection() const;
     };
 
 } // namespacepcr

Reply via email to