[Libreoffice-commits] core.git: 4 commits - sw/inc sw/source

Michael Stahl mstahl at redhat.com
Fri Oct 2 14:33:01 PDT 2015


 sw/inc/authfld.hxx                  |    9 +++--
 sw/inc/dbmgr.hxx                    |   10 +++---
 sw/source/core/doc/docfld.cxx       |    6 +--
 sw/source/core/fields/authfld.cxx   |   60 ++++++++++++++++++------------------
 sw/source/core/layout/laycache.cxx  |    3 -
 sw/source/core/layout/layhelp.hxx   |   12 +++----
 sw/source/ui/index/cnttab.cxx       |    4 ++
 sw/source/uibase/dbui/dbmgr.cxx     |   38 ++++++++++------------
 sw/source/uibase/dochdl/gloshdl.cxx |    3 +
 9 files changed, 75 insertions(+), 70 deletions(-)

New commits:
commit 64d0f4a53b749a581b5bf13919033f9bf6d5137a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 2 23:15:59 2015 +0200

    sw: replace boost::ptr_vector with std::vector
    
    Change-Id: I46bdab6995676c89f353caa3b0cf359f3aa10151

diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index fed24be..889edfe 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -130,8 +130,7 @@ bool SwLayCacheImpl::Read( SvStream& rStream )
             sal_uInt16 nPgNum(0);
             aIo.GetStream().ReadUInt16( nPgNum ).ReadUInt32( nIndex )
                    .ReadInt32( nX ).ReadInt32( nY ).ReadInt32( nW ).ReadInt32( nH );
-            SwFlyCache* pFly = new SwFlyCache( nPgNum, nIndex, nX, nY, nW, nH );
-            aFlyCache.push_back( pFly );
+            m_FlyCache.push_back(SwFlyCache( nPgNum, nIndex, nX, nY, nW, nH ));
             aIo.CloseRec( SW_LAYCACHE_IO_REC_FLY );
             break;
         }
diff --git a/sw/source/core/layout/layhelp.hxx b/sw/source/core/layout/layhelp.hxx
index ddfdad9..00d2762 100644
--- a/sw/source/core/layout/layhelp.hxx
+++ b/sw/source/core/layout/layhelp.hxx
@@ -22,8 +22,6 @@
 
 #include <swrect.hxx>
 
-#include <boost/ptr_container/ptr_vector.hpp>
-
 #include <vector>
 #include <deque>
 
@@ -50,19 +48,19 @@ class SvStream;
  */
 
 class SwFlyCache;
-typedef boost::ptr_vector<SwFlyCache> SwPageFlyCache;
+typedef std::vector<SwFlyCache> SwPageFlyCache;
 
 class SwLayCacheImpl
 {
     std::vector<sal_uLong> mIndices;
     std::deque<sal_Int32> aOffset;
     std::vector<sal_uInt16> aType;
-    SwPageFlyCache aFlyCache;
+    SwPageFlyCache m_FlyCache;
     bool bUseFlyCache;
     void Insert( sal_uInt16 nType, sal_uLong nIndex, sal_Int32 nOffset );
 
 public:
-    SwLayCacheImpl() : mIndices(), aOffset(), aType(), aFlyCache(), bUseFlyCache(false) {}
+    SwLayCacheImpl() : bUseFlyCache(false) {}
 
     size_t size() const { return mIndices.size(); }
 
@@ -72,8 +70,8 @@ public:
     sal_Int32 GetBreakOfst( size_t nIdx ) const { return aOffset[ nIdx ]; }
     sal_uInt16 GetBreakType( sal_uInt16 nIdx ) const { return aType[ nIdx ]; }
 
-    size_t GetFlyCount() const { return aFlyCache.size(); }
-    SwFlyCache& GetFlyCache( size_t nIdx ) { return aFlyCache[ nIdx ]; }
+    size_t GetFlyCount() const { return m_FlyCache.size(); }
+    SwFlyCache& GetFlyCache( size_t nIdx ) { return m_FlyCache[ nIdx ]; }
 
     bool IsUseFlyCache() const { return bUseFlyCache; }
 };
commit b1c47274ecb01752863b8967e63f2ad7771928e9
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 2 23:08:39 2015 +0200

    sw: replace boost::ptr_vector with std::vector
    
    Change-Id: Ib3dbe824bd4e747981b69851c6186fd57402ed23

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 3cabd5c..845bcc3 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -22,7 +22,6 @@
 #include "swdllapi.h"
 #include <fldbas.hxx>
 #include <toxe.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
 #include <sal/log.hxx>
 
 #include <memory>
@@ -56,7 +55,7 @@ struct SwTOXSortKey
 };
 
 class SwAuthorityField;
-typedef boost::ptr_vector<SwTOXSortKey> SortKeyArr;
+typedef std::vector<SwTOXSortKey> SortKeyArr;
 typedef std::vector<std::unique_ptr<SwAuthEntry>> SwAuthDataArr;
 
 class SW_DLLPUBLIC SwAuthorityFieldType : public SwFieldType
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 365cc6a..c7df493 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -436,23 +436,23 @@ bool    SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId )
                 for(sal_Int32 i = 0; i < aSeq.getLength() && i < USHRT_MAX / 4; i++)
                 {
                     const PropertyValue* pValue = pValues[i].getConstArray();
-                    SwTOXSortKey* pSortKey = new SwTOXSortKey;
+                    SwTOXSortKey aSortKey;
                     for(sal_Int32 j = 0; j < pValues[i].getLength(); j++)
                     {
                         if(pValue[j].Name == UNO_NAME_SORT_KEY)
                         {
                             sal_Int16 nVal = -1; pValue[j].Value >>= nVal;
                             if(nVal >= 0 && nVal < AUTH_FIELD_END)
-                                pSortKey->eField = (ToxAuthorityField) nVal;
+                                aSortKey.eField = (ToxAuthorityField) nVal;
                             else
                                 bRet = false;
                         }
                         else if(pValue[j].Name == UNO_NAME_IS_SORT_ASCENDING)
                         {
-                            pSortKey->bSortAscending = *static_cast<sal_Bool const *>(pValue[j].Value.getValue());
+                            aSortKey.bSortAscending = *static_cast<sal_Bool const *>(pValue[j].Value.getValue());
                         }
                     }
-                    m_SortKeyArr.push_back(pSortKey);
+                    m_SortKeyArr.push_back(aSortKey);
                 }
             }
         }
@@ -488,7 +488,7 @@ void SwAuthorityFieldType::SetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey aKeys[
     m_SortKeyArr.clear();
     for(sal_uInt16 i = 0; i < nKeyCount; i++)
         if(aKeys[i].eField < AUTH_FIELD_END)
-            m_SortKeyArr.push_back(new SwTOXSortKey(aKeys[i]));
+            m_SortKeyArr.push_back(SwTOXSortKey(aKeys[i]));
 }
 
 SwAuthorityField::SwAuthorityField( SwAuthorityFieldType* pInitType,
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 19b39c8..f5ac0fc 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -78,6 +78,10 @@
 #include <sfx2/app.hxx>
 
 #include <unomid.h>
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::uno;
diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx
index d3d541c..6050cf6 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -58,6 +58,9 @@
 #include <misc.hrc>
 
 #include <IDocumentFieldsAccess.hxx>
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
 #include <memory>
 
 using namespace ::com::sun::star;
commit 2cf9bc80fb472004c8c30a80a2ac0724089461e5
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 2 22:57:52 2015 +0200

    sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
    
    Change-Id: I5add8d2644bf9cc0a4a48b86028da6c44844d715

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 73e1d09..3cabd5c 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -22,10 +22,12 @@
 #include "swdllapi.h"
 #include <fldbas.hxx>
 #include <toxe.hxx>
-#include <vector>
 #include <boost/ptr_container/ptr_vector.hpp>
 #include <sal/log.hxx>
 
+#include <memory>
+#include <vector>
+
 class SwAuthEntry
 {
     OUString        aAuthFields[AUTH_FIELD_END];
@@ -55,7 +57,7 @@ struct SwTOXSortKey
 
 class SwAuthorityField;
 typedef boost::ptr_vector<SwTOXSortKey> SortKeyArr;
-typedef boost::ptr_vector<SwAuthEntry> SwAuthDataArr;
+typedef std::vector<std::unique_ptr<SwAuthEntry>> SwAuthDataArr;
 
 class SW_DLLPUBLIC SwAuthorityFieldType : public SwFieldType
 {
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index f8fa23c..365cc6a 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -64,7 +64,6 @@ bool    SwAuthEntry::operator==(const SwAuthEntry& rComp)
 SwAuthorityFieldType::SwAuthorityFieldType(SwDoc* pDoc)
     : SwFieldType( RES_AUTHORITY ),
     m_pDoc(pDoc),
-    m_DataArr(),
     m_SortKeyArr(3),
     m_cPrefix('['),
     m_cSuffix(']'),
@@ -87,7 +86,7 @@ void    SwAuthorityFieldType::RemoveField(sal_IntPtr nHandle)
 {
     for(SwAuthDataArr::size_type j = 0; j < m_DataArr.size(); ++j)
     {
-        SwAuthEntry* pTemp = &m_DataArr[j];
+        SwAuthEntry* pTemp = m_DataArr[j].get();
         sal_IntPtr nRet = reinterpret_cast<sal_IntPtr>(static_cast<void*>(pTemp));
         if(nRet == nHandle)
         {
@@ -112,21 +111,22 @@ sal_IntPtr SwAuthorityFieldType::AddField(const OUString& rFieldContents)
         pEntry->SetAuthorField( static_cast<ToxAuthorityField>(i),
                         rFieldContents.getToken( i, TOX_STYLE_DELIMITER ));
 
-    for(auto &rTemp : m_DataArr)
+    for (auto &rpTemp : m_DataArr)
     {
-        if(rTemp == *pEntry)
+        if (*rpTemp == *pEntry)
         {
             delete pEntry;
-            nRet = reinterpret_cast<sal_IntPtr>(static_cast<void*>(&rTemp));
-            rTemp.AddRef();
+            nRet = reinterpret_cast<sal_IntPtr>(static_cast<void*>(rpTemp.get()));
+            rpTemp->AddRef();
             return nRet;
         }
     }
 
     //if it is a new Entry - insert
     nRet = reinterpret_cast<sal_IntPtr>(static_cast<void*>(pEntry));
+    // FIXME: what is this ref-counting madness on a object owned by the container?
     pEntry->AddRef();
-    m_DataArr.push_back(pEntry);
+    m_DataArr.push_back(std::unique_ptr<SwAuthEntry>(pEntry));
     //re-generate positions of the fields
     DelSequenceArray();
     return nRet;
@@ -134,12 +134,12 @@ sal_IntPtr SwAuthorityFieldType::AddField(const OUString& rFieldContents)
 
 bool SwAuthorityFieldType::AddField(sal_IntPtr nHandle)
 {
-    for(auto &rTemp : m_DataArr)
+    for (auto &rpTemp : m_DataArr)
     {
-        sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>(static_cast<void*>(&rTemp));
+        sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>(static_cast<void*>(rpTemp.get()));
         if( nTmp == nHandle )
         {
-            rTemp.AddRef();
+            rpTemp->AddRef();
             //re-generate positions of the fields
             DelSequenceArray();
             return true;
@@ -151,12 +151,12 @@ bool SwAuthorityFieldType::AddField(sal_IntPtr nHandle)
 
 const SwAuthEntry*  SwAuthorityFieldType::GetEntryByHandle(sal_IntPtr nHandle) const
 {
-    for(auto &rTemp : m_DataArr)
+    for (auto &rpTemp : m_DataArr)
     {
-        sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>(static_cast<void const *>(&rTemp));
+        sal_IntPtr nTmp = reinterpret_cast<sal_IntPtr>(static_cast<void const *>(rpTemp.get()));
         if( nTmp == nHandle )
         {
-            return &rTemp;
+            return rpTemp.get();
         }
     }
     OSL_FAIL( "invalid Handle" );
@@ -166,20 +166,20 @@ const SwAuthEntry*  SwAuthorityFieldType::GetEntryByHandle(sal_IntPtr nHandle) c
 void SwAuthorityFieldType::GetAllEntryIdentifiers(
     std::vector<OUString>& rToFill )const
 {
-    for(const auto &rTemp : m_DataArr)
+    for (const auto & rpTemp : m_DataArr)
     {
-        rToFill.push_back(rTemp.GetAuthorField(AUTH_FIELD_IDENTIFIER));
+        rToFill.push_back(rpTemp->GetAuthorField(AUTH_FIELD_IDENTIFIER));
     }
 }
 
 const SwAuthEntry*  SwAuthorityFieldType::GetEntryByIdentifier(
                                 const OUString& rIdentifier)const
 {
-    for(const auto &rTemp : m_DataArr)
+    for (const auto &rpTemp : m_DataArr)
     {
-        if( rIdentifier == rTemp.GetAuthorField( AUTH_FIELD_IDENTIFIER ))
+        if (rIdentifier == rpTemp->GetAuthorField(AUTH_FIELD_IDENTIFIER))
         {
-            return &rTemp;
+            return rpTemp.get();
         }
     }
     return nullptr;
@@ -187,14 +187,16 @@ const SwAuthEntry*  SwAuthorityFieldType::GetEntryByIdentifier(
 
 bool SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry)
 {
-    for(auto &rTemp : m_DataArr)
+    for (auto &rpTemp : m_DataArr)
     {
-        if(rTemp.GetAuthorField(AUTH_FIELD_IDENTIFIER) ==
+        if (rpTemp->GetAuthorField(AUTH_FIELD_IDENTIFIER) ==
                     pNewEntry->GetAuthorField(AUTH_FIELD_IDENTIFIER))
         {
             for(int i = 0; i < AUTH_FIELD_END; ++i)
-                rTemp.SetAuthorField((ToxAuthorityField) i,
+            {
+                rpTemp->SetAuthorField((ToxAuthorityField) i,
                     pNewEntry->GetAuthorField((ToxAuthorityField)i));
+            }
             return true;
         }
     }
@@ -206,7 +208,7 @@ sal_uInt16  SwAuthorityFieldType::AppendField( const SwAuthEntry& rInsert )
 {
     for( SwAuthDataArr::size_type nRet = 0; nRet < m_DataArr.size(); ++nRet )
     {
-        SwAuthEntry* pTemp = &m_DataArr[ nRet ];
+        SwAuthEntry* pTemp = m_DataArr[ nRet ].get();
         if( *pTemp == rInsert )
         {
             //ref count unchanged
@@ -215,7 +217,7 @@ sal_uInt16  SwAuthorityFieldType::AppendField( const SwAuthEntry& rInsert )
     }
 
     //if it is a new Entry - insert
-    m_DataArr.push_back( new SwAuthEntry( rInsert ) );
+    m_DataArr.push_back(std::unique_ptr<SwAuthEntry>(new SwAuthEntry(rInsert)));
     return m_DataArr.size()-1;
 }
 
@@ -223,7 +225,7 @@ sal_IntPtr SwAuthorityFieldType::GetHandle(sal_uInt16 nPos)
 {
     if( nPos < m_DataArr.size() )
     {
-        SwAuthEntry* pTemp = &m_DataArr[nPos];
+        SwAuthEntry* pTemp = m_DataArr[nPos].get();
         return reinterpret_cast<sal_IntPtr>(static_cast<void*>(pTemp));
     }
     return 0;
commit 38ea2d0ecc1d59844f9371ae6da7980c4e3a9e10
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Oct 2 22:19:38 2015 +0200

    sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
    
    Change-Id: Ia9fa057971024f4af7d1ab8212412731b64728d7

diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index 0f5378a..d1dcad4 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -30,7 +30,9 @@
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/embed/XStorage.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
+
+#include <memory>
+#include <vector>
 
 namespace com{namespace sun{namespace star{
     namespace sdbc{
@@ -136,7 +138,7 @@ struct SwDSParam : public SwDBData
                 bAfterSelection = true;
         }
 };
-typedef boost::ptr_vector<SwDSParam> SwDSParamArr;
+typedef std::vector<std::unique_ptr<SwDSParam>> SwDSParams_t;
 
 struct SwMergeDescriptor
 {
@@ -198,7 +200,7 @@ friend class SwConnectionDisposedListener_Impl;
     bool            bMergeSilent : 1;   ///< suppress display of dialogs/boxes (used when called over API)
     bool            bMergeLock : 1;     /**< prevent update of database fields while document is
                                              actually printed at the SwViewShell */
-    SwDSParamArr        aDataSourceParams;
+    SwDSParams_t    m_DataSourceParams;
     SwDBManager_Impl*    pImpl;
     const SwXMailMerge* pMergeEvtSrc;   ///< != 0 if mail merge events are to be send
     /// Name of the embedded database that's included in the current document.
@@ -309,7 +311,7 @@ public:
 
     const SwDSParam* CreateDSData(const SwDBData& rData)
                         {return FindDSData(rData, true);}
-    const SwDSParamArr& GetDSParamArray() const {return aDataSourceParams;}
+    const SwDSParams_t& GetDSParamArray() const { return m_DataSourceParams; }
 
     /// close all data sources - after fields were updated
     void            CloseAll(bool bIncludingMerge = true);
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 410892e..b61ed14 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -511,10 +511,10 @@ void SwDoc::GetAllDBNames( std::vector<OUString>& rAllDBNames )
 #else
     SwDBManager* pMgr = GetDBManager();
 
-    const SwDSParamArr& rArr = pMgr->GetDSParamArray();
-    for(const auto &aParam : rArr)
+    const SwDSParams_t& rArr = pMgr->GetDSParamArray();
+    for (const auto& pParam : rArr)
     {
-        rAllDBNames.push_back(aParam.sDataSource + OUString(DB_DELIM) + aParam.sCommand);
+        rAllDBNames.push_back(pParam->sDataSource + OUString(DB_DELIM) + pParam->sCommand);
     }
 #endif
 }
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 6498827..4740c6e 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -433,8 +433,8 @@ bool SwDBManager::MergeNew( const SwMergeDescriptor& rMergeDesc, vcl::Window* pP
             *pTemp = *pImpl->pMergeData;
         else
         {
-            SwDSParam* pInsert = new SwDSParam(*pImpl->pMergeData);
-            aDataSourceParams.push_back(pInsert);
+            std::unique_ptr<SwDSParam> pInsert(new SwDSParam(*pImpl->pMergeData));
+            m_DataSourceParams.push_back(std::move(pInsert));
             try
             {
                 uno::Reference<lang::XComponent> xComponent(pInsert->xConnection, uno::UNO_QUERY);
@@ -788,9 +788,8 @@ SwDBManager::SwDBManager(SwDoc* pDoc)
 
 SwDBManager::~SwDBManager()
 {
-    for(size_t nPos = 0; nPos < aDataSourceParams.size(); nPos++)
+    for (auto & pParam : m_DataSourceParams)
     {
-        SwDSParam* pParam = &aDataSourceParams[nPos];
         if(pParam->xConnection.is())
         {
             try
@@ -2357,10 +2356,9 @@ void    SwDBManager::CloseAll(bool bIncludingMerge)
 {
     //the only thing done here is to reset the selection index
     //all connections stay open
-    for(size_t nPos = 0; nPos < aDataSourceParams.size(); nPos++)
+    for (auto & pParam : m_DataSourceParams)
     {
-        SwDSParam* pParam = &aDataSourceParams[nPos];
-        if(bIncludingMerge || pParam != pImpl->pMergeData)
+        if(bIncludingMerge || pParam.get() != pImpl->pMergeData)
         {
             pParam->nSelectionIndex = 0;
             pParam->bAfterSelection = false;
@@ -2388,9 +2386,9 @@ SwDSParam* SwDBManager::FindDSData(const SwDBData& rData, bool bCreate)
     }
 
     SwDSParam* pFound = 0;
-    for(sal_uInt16 nPos = aDataSourceParams.size(); nPos; nPos--)
+    for (size_t nPos = m_DataSourceParams.size(); nPos; nPos--)
     {
-        SwDSParam* pParam = &aDataSourceParams[nPos - 1];
+        SwDSParam* pParam = m_DataSourceParams[nPos - 1].get();
         if(rData.sDataSource == pParam->sDataSource &&
             rData.sCommand == pParam->sCommand &&
             (rData.nCommandType == -1 || rData.nCommandType == pParam->nCommandType ||
@@ -2410,7 +2408,7 @@ SwDSParam* SwDBManager::FindDSData(const SwDBData& rData, bool bCreate)
         if(!pFound)
         {
             pFound = new SwDSParam(rData);
-            aDataSourceParams.push_back(pFound);
+            m_DataSourceParams.push_back(std::unique_ptr<SwDSParam>(pFound));
             try
             {
                 uno::Reference<lang::XComponent> xComponent(pFound->xConnection, uno::UNO_QUERY);
@@ -2433,12 +2431,11 @@ SwDSParam*  SwDBManager::FindDSConnection(const OUString& rDataSource, bool bCre
          return pImpl->pMergeData;
     }
     SwDSParam* pFound = 0;
-    for(size_t nPos = 0; nPos < aDataSourceParams.size(); nPos++)
+    for (auto & pParam : m_DataSourceParams)
     {
-        SwDSParam* pParam = &aDataSourceParams[nPos];
         if(rDataSource == pParam->sDataSource)
         {
-            pFound = pParam;
+            pFound = pParam.get();
             break;
         }
     }
@@ -2447,7 +2444,7 @@ SwDSParam*  SwDBManager::FindDSConnection(const OUString& rDataSource, bool bCre
         SwDBData aData;
         aData.sDataSource = rDataSource;
         pFound = new SwDSParam(aData);
-        aDataSourceParams.push_back(pFound);
+        m_DataSourceParams.push_back(std::unique_ptr<SwDSParam>(pFound));
         try
         {
             uno::Reference<lang::XComponent> xComponent(pFound->xConnection, uno::UNO_QUERY);
@@ -2915,10 +2912,9 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh,
     }
     if(pFound)
     {
-        for(size_t nPos = 0; nPos < aDataSourceParams.size(); nPos++)
+        for (auto & pParam : m_DataSourceParams)
         {
-            SwDSParam* pParam = &aDataSourceParams[nPos];
-            if(pParam == pFound)
+            if (pParam.get() == pFound)
             {
                 try
                 {
@@ -3116,14 +3112,14 @@ void SwConnectionDisposedListener_Impl::disposing( const lang::EventObject& rSou
     if (!m_pDBManager) return; // we're disposed too!
 
     uno::Reference<sdbc::XConnection> xSource(rSource.Source, uno::UNO_QUERY);
-    for (size_t nPos = m_pDBManager->aDataSourceParams.size(); nPos; nPos--)
+    for (size_t nPos = m_pDBManager->m_DataSourceParams.size(); nPos; nPos--)
     {
-        SwDSParam* pParam = &m_pDBManager->aDataSourceParams[nPos - 1];
+        SwDSParam* pParam = m_pDBManager->m_DataSourceParams[nPos - 1].get();
         if(pParam->xConnection.is() &&
                 (xSource == pParam->xConnection))
         {
-            m_pDBManager->aDataSourceParams.erase(
-                    m_pDBManager->aDataSourceParams.begin() + nPos - 1);
+            m_pDBManager->m_DataSourceParams.erase(
+                    m_pDBManager->m_DataSourceParams.begin() + nPos - 1);
         }
     }
 }


More information about the Libreoffice-commits mailing list