[Libreoffice-commits] core.git: dbaccess/source

Caolán McNamara caolanm at redhat.com
Wed Mar 9 09:50:30 UTC 2016


 dbaccess/source/core/api/RowSetCache.cxx |   15 ++++++++++++++-
 dbaccess/source/core/api/RowSetCache.hxx |    1 +
 2 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 29fc44c6f8478f218d7b9959cf8a9e7141a26ce6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 9 09:45:53 2016 +0000

    fix debugging stl iterators assert in bibliography toolbar
    
    bibliography: click autofilter toolbar icon to get drop down, select an
    entry and assert on use of invalid iterators.
    
    In this specific case we want to reset them all, so add a new simpler
    method to just do that and not do the (always supposed to be true) comparison
    
    note: in ORowSet::checkUpdateIterator
    at m_aCurrentRow = m_pCache->m_aInsertRow; these iterators are then invalid
    the whole iterator caching and fiddling here is concerning.
    
    Change-Id: I74952896f47ac482b6bacb26afe5b1cfcf6bc49c

diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 1d4970a..f298c44 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -1488,6 +1488,19 @@ void ORowSetCache::rotateCacheIterator(ORowSetMatrix::difference_type _nDist)
     }
 }
 
+void ORowSetCache::rotateAllCacheIterators()
+{
+    // now correct the iterator in our iterator vector
+    auto aCacheEnd  = m_aCacheIterators.end();
+    for (auto aCacheIter = m_aCacheIterators.begin(); aCacheIter != aCacheEnd; ++aCacheIter)
+    {
+        if (!aCacheIter->second.pRowSet->isInsertRow() && !m_bModified)
+        {
+            aCacheIter->second.aIterator = m_pMatrix->end();
+        }
+    }
+}
+
 void ORowSetCache::setUpdateIterator(const ORowSetMatrix::iterator& _rOriginalRow)
 {
     m_aInsertRow = m_pInsertMatrix->begin();
@@ -1676,7 +1689,7 @@ bool ORowSetCache::reFillMatrix(sal_Int32 _nNewStartPos, sal_Int32 _nNewEndPos)
     bool bRet = fillMatrix(nNewSt,_nNewEndPos);
     m_nStartPos = nNewSt;
     m_nEndPos = _nNewEndPos;
-    rotateCacheIterator(static_cast<ORowSetMatrix::difference_type>(m_nFetchSize+1)); // invalidate every iterator
+    rotateAllCacheIterators(); // invalidate every iterator
     return bRet;
 }
 
diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx
index a41aaf7..86bb8cc 100644
--- a/dbaccess/source/core/api/RowSetCache.hxx
+++ b/dbaccess/source/core/api/RowSetCache.hxx
@@ -100,6 +100,7 @@ namespace dbaccess
         void moveWindow();
 
         void rotateCacheIterator(ORowSetMatrix::difference_type _nDist);
+        void rotateAllCacheIterators();
         void updateValue(sal_Int32 columnIndex
                         ,const connectivity::ORowSetValue& x
                         ,ORowSetValueVector::Vector& io_aRow


More information about the Libreoffice-commits mailing list