connectivity/source/drivers/odbc/OStatement.cxx        |   22 +-
 connectivity/source/inc/odbc/OStatement.hxx            |    5 
 dbaccess/source/core/dataaccess/myucp_datasupplier.cxx |   30 +--
 dbaccess/source/core/dataaccess/myucp_datasupplier.hxx |   17 +
 include/ucbhelper/resultset.hxx                        |   19 +-
 ucb/source/ucp/cmis/cmis_datasupplier.cxx              |   22 +-
 ucb/source/ucp/cmis/cmis_datasupplier.hxx              |   12 -
 ucb/source/ucp/ext/ucpext_datasupplier.cxx             |   18 -
 ucb/source/ucp/ext/ucpext_datasupplier.hxx             |   12 -
 ucb/source/ucp/gio/gio_datasupplier.cxx                |   22 +-
 ucb/source/ucp/gio/gio_datasupplier.hxx                |   12 -
 ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx     |   36 ++-
 ucb/source/ucp/hierarchy/hierarchydatasupplier.hxx     |   16 -
 ucb/source/ucp/package/pkgdatasupplier.cxx             |   40 ++--
 ucb/source/ucp/package/pkgdatasupplier.hxx             |   18 -
 ucb/source/ucp/tdoc/tdoc_datasupplier.cxx              |   42 ++--
 ucb/source/ucp/tdoc/tdoc_datasupplier.hxx              |   18 -
 ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx      |   30 +--
 ucb/source/ucp/webdav-curl/webdavdatasupplier.hxx      |   14 -
 ucbhelper/source/provider/resultset.cxx                |  154 +++++++++++------
 20 files changed, 313 insertions(+), 246 deletions(-)

New commits:
commit 6571e77d03491090c9d3a4ef74295bd4cfc3fda4
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Sep 30 15:35:25 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Mon Sep 30 18:24:41 2024 +0200

    use more concrete UNO type in odbc::OStatement_Base
    
    Change-Id: I86073baf25e2f10a57879fcedbbb1c0e8c354813
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174281
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/connectivity/source/drivers/odbc/OStatement.cxx 
b/connectivity/source/drivers/odbc/OStatement.cxx
index 13970dc7b80e..895bfa59dc60 100644
--- a/connectivity/source/drivers/odbc/OStatement.cxx
+++ b/connectivity/source/drivers/odbc/OStatement.cxx
@@ -83,10 +83,12 @@ OStatement_Base::~OStatement_Base()
 void OStatement_Base::disposeResultSet()
 {
     // free the cursor if alive
-    Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
+    rtl::Reference< OResultSet > xComp(m_xResultSet.get());
     if (xComp.is())
+    {
         xComp->dispose();
-    m_xResultSet.clear();
+        m_xResultSet.clear();
+    }
 }
 
 void SAL_CALL OStatement_Base::disposing()
@@ -208,8 +210,7 @@ void OStatement_Base::clearMyResultSet()
 
     try
     {
-        Reference<XCloseable> xCloseable(
-            m_xResultSet.get(), css::uno::UNO_QUERY);
+        rtl::Reference<OResultSet> xCloseable(m_xResultSet.get());
         if ( xCloseable.is() )
             xCloseable->close();
     }
@@ -362,7 +363,7 @@ sal_Bool SAL_CALL OStatement_Base::execute( const OUString& 
sql )
 // getResultSet returns the current result as a ResultSet.  It
 // returns NULL if the current result is not a ResultSet.
 
-Reference< XResultSet > OStatement_Base::getResultSet(bool checkCount)
+rtl::Reference< OResultSet > OStatement_Base::getResultSet(bool checkCount)
 {
     ::osl::MutexGuard aGuard( m_aMutex );
     checkDisposed(OStatement_BASE::rBHelper.bDisposed);
@@ -427,15 +428,15 @@ Reference< XResultSet > SAL_CALL 
OStatement_Base::executeQuery( const OUString&
     checkDisposed(OStatement_BASE::rBHelper.bDisposed);
 
 
-    Reference< XResultSet > xRS;
+    rtl::Reference< OResultSet > xRS;
 
     // Execute the statement.  If execute returns true, a result
     // set exists.
 
     if (execute (sql))
     {
-        xRS = getResultSet (false);
-        m_xResultSet = xRS;
+        xRS = getResultSet(false);
+        m_xResultSet = xRS.get();
     }
     else
     {
@@ -542,8 +543,9 @@ Reference< XResultSet > SAL_CALL 
OStatement_Base::getResultSet(  )
     checkDisposed(OStatement_BASE::rBHelper.bDisposed);
 
 
-    m_xResultSet = getResultSet(true);
-    return m_xResultSet;
+    rtl::Reference<OResultSet> xRS = getResultSet(true);
+    m_xResultSet = xRS.get();
+    return xRS;
 }
 
 
diff --git a/connectivity/source/inc/odbc/OStatement.hxx 
b/connectivity/source/inc/odbc/OStatement.hxx
index 773e79b8d266..2de1e905364d 100644
--- a/connectivity/source/inc/odbc/OStatement.hxx
+++ b/connectivity/source/inc/odbc/OStatement.hxx
@@ -37,6 +37,7 @@
 #include <string_view>
 #include <vector>
 #include <com/sun/star/lang/XServiceInfo.hpp>
+#include <unotools/weakref.hxx>
 
 namespace connectivity::odbc
     {
@@ -61,7 +62,7 @@ namespace connectivity::odbc
         {
             css::sdbc::SQLWarning                             m_aLastWarning;
         protected:
-            css::uno::WeakReference< css::sdbc::XResultSet>   m_xResultSet;   
// The last ResultSet created
+            unotools::WeakReference< OResultSet >             m_xResultSet;   
// The last ResultSet created
             css::uno::Reference< css::sdbc::XStatement>       
m_xGeneratedStatement;
             //  for this Statement
 
@@ -122,7 +123,7 @@ namespace connectivity::odbc
 
             /// @throws css::sdbc::SQLException
             /// @throws css::uno::RuntimeException
-            css::uno::Reference<css::sdbc::XResultSet> getResultSet(bool 
checkCount);
+            rtl::Reference<OResultSet> getResultSet(bool checkCount);
             /**
                 creates the driver specific resultset (factory)
             */
commit da8a36b4f4fa86831dabbfe7794c835cd5f975b4
Author:     Noel Grandin <[email protected]>
AuthorDate: Sun Sep 29 19:27:50 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Mon Sep 30 18:24:30 2024 +0200

    CID#1607066:Data race condition (MISSING_LOCK)
    
    which means we need to push knowledge
    about the locking down into ucbhelper::Result
    since the implementation classes there
    want to call back into the parent.
    
    and also
    
    CID#1607968:Data race condition (MISSING_LOCK)
    CID#1606657:Data race condition (MISSING_LOCK)
    CID#1607112:Data race condition (MISSING_LOCK)
    CID#1608365:Data race condition (MISSING_LOCK)
    CID#1607159:Data race condition (MISSING_LOCK)
    CID#1607018:Data race condition (MISSING_LOCK)
    CID#1607421:Data race condition (MISSING_LOCK)
    CID#1607766:Data race condition (MISSING_LOCK)
    CID#1606872:Data race condition (MISSING_LOCK)
    CID#1608523:Data race condition (MISSING_LOCK
    CID#1607191:Data race condition (MISSING_LOCK)
    CID#1608345:Data race condition (MISSING_LOCK)
    CID#1608577:(#1 of 1):Data race condition (MISSING_LOCK)
    CID#1607210:Data race condition (MISSING_LOCK)
    CID#1607132:Data race condition (MISSING_LOCK)
    CID#1608256:Data race condition (MISSING_LOCK)
    CID#1607482:Data race condition (MISSING_LOCK)
    CID#1607935:Data race condition (MISSING_LOCK)
    CID#1608070:Data race condition (MISSING_LOCK)
    CID#1607901:Data race condition (MISSING_LOCK)
    CID#1608013:Data race condition (MISSING_LOCK)
    CID#1607506:Data race condition (MISSING_LOCK)
    CID#1607526:Data race condition (MISSING_LOCK)
    CID#1607044:Data race condition (MISSING_LOCK)
    CID#1607708:Data race condition (MISSING_LOCK)
    CID#1608041:Data race condition (MISSING_LOCK)
    CID#1608207:Data race condition (MISSING_LOCK)
    CID#1608028:Data race condition (MISSING_LOCK)
    CID#1608168:Data race condition (MISSING_LOCK)
    CID#1607561:Data race condition (MISSING_LOCK)
    
    CID#1607689:Check of thread-shared field evades lock acquisition 
(LOCK_EVASION)
    CID#1607689:Check of thread-shared field evades lock acquisition 
(LOCK_EVASION)
    CID#1607689:Check of thread-shared field evades lock acquisition 
(LOCK_EVASION)
    CID#1607689:Check of thread-shared field evades lock acquisition 
(LOCK_EVASION)
    CID#1607689:Check of thread-shared field evades lock acquisition 
(LOCK_EVASION)
    CID#1607689:Check of thread-shared field evades lock acquisition 
(LOCK_EVASION)
    CID#1607689:Check of thread-shared field evades lock acquisition 
(LOCK_EVASION)
    CID#1607689:Check of thread-shared field evades lock acquisition 
(LOCK_EVASION)
    CID#1607689:Check of thread-shared field evades lock acquisition 
(LOCK_EVASION)
    CID#1607689:Check of thread-shared field evades lock acquisition 
(LOCK_EVASION)
    
    Change-Id: Ifbe908a4a86ab8c5fa1c4ed3b6f9466508e4900e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174204
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx 
b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
index 1b04127cf67f..597933b9db5f 100644
--- a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
+++ b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
@@ -42,7 +42,7 @@ DataSupplier::~DataSupplier()
 {
 }
 
-OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
+OUString DataSupplier::queryContentIdentifierString( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex )
 {
     osl::Guard< osl::Mutex > aGuard( m_aMutex );
 
@@ -56,7 +56,7 @@ OUString DataSupplier::queryContentIdentifierString( 
sal_uInt32 nIndex )
         }
     }
 
-    if ( getResult( nIndex ) )
+    if ( getResult( rResultSetGuard, nIndex ) )
     {
         OUString aId = m_xContent->getIdentifier()->getContentIdentifier();
 
@@ -72,7 +72,7 @@ OUString DataSupplier::queryContentIdentifierString( 
sal_uInt32 nIndex )
 }
 
 Reference< XContentIdentifier >
-DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
+DataSupplier::queryContentIdentifier( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex )
 {
     osl::Guard< osl::Mutex > aGuard( m_aMutex );
 
@@ -86,7 +86,7 @@ DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
         }
     }
 
-    OUString aId = queryContentIdentifierString( nIndex );
+    OUString aId = queryContentIdentifierString( rResultSetGuard, nIndex );
     if ( !aId.isEmpty() )
     {
         Reference< XContentIdentifier > xId = new 
::ucbhelper::ContentIdentifier( aId );
@@ -97,7 +97,7 @@ DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
 }
 
 Reference< XContent >
-DataSupplier::queryContent( sal_uInt32 _nIndex )
+DataSupplier::queryContent( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 _nIndex )
 {
     osl::Guard< osl::Mutex > aGuard( m_aMutex );
 
@@ -111,7 +111,7 @@ DataSupplier::queryContent( sal_uInt32 _nIndex )
         }
     }
 
-    Reference< XContentIdentifier > xId = queryContentIdentifier( _nIndex );
+    Reference< XContentIdentifier > xId = queryContentIdentifier( 
rResultSetGuard, _nIndex );
     if ( xId.is() )
     {
         try
@@ -133,7 +133,7 @@ DataSupplier::queryContent( sal_uInt32 _nIndex )
     return Reference< XContent >();
 }
 
-bool DataSupplier::getResult( sal_uInt32 nIndex )
+bool DataSupplier::getResult( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex )
 {
     osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
 
@@ -177,16 +177,16 @@ bool DataSupplier::getResult( sal_uInt32 nIndex )
         aGuard.clear();
 
         if ( static_cast<size_t>(nOldCount) < m_aResults.size() )
-            xResultSet->rowCountChanged( nOldCount, m_aResults.size() );
+            xResultSet->rowCountChanged( rResultSetGuard, nOldCount, 
m_aResults.size() );
 
         if ( m_bCountFinal )
-            xResultSet->rowCountFinal();
+            xResultSet->rowCountFinal(rResultSetGuard);
     }
 
     return bFound;
 }
 
-sal_uInt32 DataSupplier::totalCount()
+sal_uInt32 DataSupplier::totalCount(std::unique_lock<std::mutex>& 
rResultSetGuard)
 {
     osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
 
@@ -212,9 +212,9 @@ sal_uInt32 DataSupplier::totalCount()
         aGuard.clear();
 
         if ( static_cast<size_t>(nOldCount) < m_aResults.size() )
-            xResultSet->rowCountChanged( nOldCount, m_aResults.size() );
+            xResultSet->rowCountChanged( rResultSetGuard, nOldCount, 
m_aResults.size() );
 
-        xResultSet->rowCountFinal();
+        xResultSet->rowCountFinal(rResultSetGuard);
     }
 
     return m_aResults.size();
@@ -231,7 +231,7 @@ bool DataSupplier::isCountFinal()
 }
 
 Reference< XRow >
-DataSupplier::queryPropertyValues( sal_uInt32 nIndex  )
+DataSupplier::queryPropertyValues( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex  )
 {
     osl::Guard< osl::Mutex > aGuard( m_aMutex );
 
@@ -245,10 +245,10 @@ DataSupplier::queryPropertyValues( sal_uInt32 nIndex  )
         }
     }
 
-    if ( getResult( nIndex ) )
+    if ( getResult( rResultSetGuard, nIndex ) )
     {
         if ( !m_aResults[ nIndex ]->xContent.is() )
-            queryContent(nIndex);
+            queryContent(rResultSetGuard, nIndex);
 
         Reference< XRow > xRow = m_aResults[ nIndex 
]->xContent->getPropertyValues(getResultSet()->getProperties());
         m_aResults[ nIndex ]->xRow = xRow;
diff --git a/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx 
b/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx
index 65a45ad7fef6..b9eecab2ddff 100644
--- a/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx
+++ b/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx
@@ -52,18 +52,23 @@ public:
     explicit DataSupplier(const rtl::Reference<ODocumentContainer>& rxContent);
     virtual ~DataSupplier() override;
 
-    virtual OUString queryContentIdentifierString(sal_uInt32 nIndex) override;
+    virtual OUString 
queryContentIdentifierString(std::unique_lock<std::mutex>& rResultSetGuard,
+                                                  sal_uInt32 nIndex) override;
     virtual css::uno::Reference<css::ucb::XContentIdentifier>
-    queryContentIdentifier(sal_uInt32 nIndex) override;
-    virtual css::uno::Reference<css::ucb::XContent> queryContent(sal_uInt32 
nIndex) override;
+    queryContentIdentifier(std::unique_lock<std::mutex>& rResultSetGuard,
+                           sal_uInt32 nIndex) override;
+    virtual css::uno::Reference<css::ucb::XContent>
+    queryContent(std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 
nIndex) override;
 
-    virtual bool getResult(sal_uInt32 nIndex) override;
+    virtual bool getResult(std::unique_lock<std::mutex>& rResultSetGuard,
+                           sal_uInt32 nIndex) override;
 
-    virtual sal_uInt32 totalCount() override;
+    virtual sal_uInt32 totalCount(std::unique_lock<std::mutex>& 
rResultSetGuard) override;
     virtual sal_uInt32 currentCount() override;
     virtual bool isCountFinal() override;
 
-    virtual css::uno::Reference<css::sdbc::XRow> 
queryPropertyValues(sal_uInt32 nIndex) override;
+    virtual css::uno::Reference<css::sdbc::XRow>
+    queryPropertyValues(std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex) override;
     virtual void releasePropertyValues(sal_uInt32 nIndex) override;
 
     virtual void close() override;
diff --git a/include/ucbhelper/resultset.hxx b/include/ucbhelper/resultset.hxx
index 3884509e2045..a4faf3a9b9d1 100644
--- a/include/ucbhelper/resultset.hxx
+++ b/include/ucbhelper/resultset.hxx
@@ -34,6 +34,7 @@
 #include <cppuhelper/implbase.hxx>
 #include <ucbhelper/ucbhelperdllapi.h>
 #include <memory>
+#include <mutex>
 
 namespace com::sun::star::uno { class XComponentContext; }
 namespace com::sun::star::ucb { class XCommandEnvironment; }
@@ -245,6 +246,8 @@ public:
       */
     void propertyChanged(
                 const css::beans::PropertyChangeEvent& rEvt ) const;
+    void propertyChanged(std::unique_lock<std::mutex>& rGuard,
+                const css::beans::PropertyChangeEvent& rEvt ) const;
 
     /**
       * This method should be called by the data supplier for the result set
@@ -253,13 +256,13 @@ public:
       * @param nOld is the old count of rows; must be non-negative.
       * @param nnew is the new count of rows; must be non-negative.
       */
-    UCBHELPER_DLLPUBLIC void rowCountChanged( sal_uInt32 nOld, sal_uInt32 nNew 
);
+    UCBHELPER_DLLPUBLIC void rowCountChanged( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nOld, sal_uInt32 nNew );
 
     /**
       * This method should be called by the data supplier for the result set
       * to indicate that there were all rows obtained from the data source.
       */
-    UCBHELPER_DLLPUBLIC void rowCountFinal();
+    UCBHELPER_DLLPUBLIC void rowCountFinal(std::unique_lock<std::mutex>& 
rResultSetGuard);
 
     /**
       * This method returns a sequence containing all properties ( not the
@@ -312,7 +315,7 @@ public:
      *               of the supplier; must be non-negative.
      * @return the content's identifier string.
      */
-    virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) = 0;
+    virtual OUString queryContentIdentifierString( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) = 0;
 
     /**
      * This method returns the identifier of the content at the specified 
index.
@@ -322,7 +325,7 @@ public:
      * @return the content's identifier.
      */
     virtual css::uno::Reference< css::ucb::XContentIdentifier >
-    queryContentIdentifier( sal_uInt32 nIndex ) = 0;
+    queryContentIdentifier( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) = 0;
 
     /**
      * This method returns the content at the specified index.
@@ -332,7 +335,7 @@ public:
      * @return the content.
      */
     virtual css::uno::Reference< css::ucb::XContent >
-    queryContent( sal_uInt32 nIndex ) = 0;
+    queryContent( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 
nIndex ) = 0;
 
     /**
      * This method returns whether there is a content at the specified index.
@@ -341,7 +344,7 @@ public:
      *               of the supplier; must be non-negative.
      * @return true, if there is a content at the given index.
      */
-    virtual bool getResult( sal_uInt32 nIndex ) = 0;
+    virtual bool getResult( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) = 0;
 
     /**
      * This method returns the total count of objects in the logical data array
@@ -352,7 +355,7 @@ public:
      *
      * @return the total count of objects; will always be non-negative.
      */
-    virtual sal_uInt32 totalCount() = 0;
+    virtual sal_uInt32 totalCount(std::unique_lock<std::mutex>& 
rResultSetGuard) = 0;
 
     /**
      * This method returns the count of objects obtained so far. There is no
@@ -390,7 +393,7 @@ public:
      * @return the object for accessing the property values.
      */
     virtual css::uno::Reference< css::sdbc::XRow >
-    queryPropertyValues( sal_uInt32 nIndex  ) = 0;
+    queryPropertyValues( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex  ) = 0;
 
     /**
      * This method is called to instruct the supplier to release the (possibly
diff --git a/ucb/source/ucp/cmis/cmis_datasupplier.cxx 
b/ucb/source/ucp/cmis/cmis_datasupplier.cxx
index 21ac2602de41..2b9cca5fdd4b 100644
--- a/ucb/source/ucp/cmis/cmis_datasupplier.cxx
+++ b/ucb/source/ucp/cmis/cmis_datasupplier.cxx
@@ -50,27 +50,27 @@ namespace cmis
     {
     }
 
-    OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
+    OUString DataSupplier::queryContentIdentifierString( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex )
     {
-        auto const xTemp(queryContentIdentifier(nIndex));
+        auto const xTemp(queryContentIdentifier(rResultSetGuard, nIndex));
         return (xTemp.is()) ? xTemp->getContentIdentifier() : OUString();
     }
 
-    uno::Reference< ucb::XContentIdentifier > 
DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
+    uno::Reference< ucb::XContentIdentifier > 
DataSupplier::queryContentIdentifier( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex )
     {
-        auto const xTemp(queryContent(nIndex));
+        auto const xTemp(queryContent(rResultSetGuard, nIndex));
         return (xTemp.is()) ? xTemp->getIdentifier() : 
uno::Reference<ucb::XContentIdentifier>();
     }
 
-    uno::Reference< ucb::XContent > DataSupplier::queryContent( sal_uInt32 
nIndex )
+    uno::Reference< ucb::XContent > DataSupplier::queryContent( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex )
     {
-        if (!getResult(nIndex))
+        if (!getResult(rResultSetGuard, nIndex))
             return uno::Reference<ucb::XContent>();
 
         return maResults[ nIndex ].xContent;
     }
 
-    bool DataSupplier::getResult( sal_uInt32 nIndex )
+    bool DataSupplier::getResult( std::unique_lock<std::mutex>& 
/*rResultSetGuard*/, sal_uInt32 nIndex )
     {
         if ( maResults.size() > nIndex ) // Result already present.
             return true;
@@ -79,7 +79,7 @@ namespace cmis
         return maResults.size() > nIndex;
     }
 
-    sal_uInt32 DataSupplier::totalCount()
+    sal_uInt32 DataSupplier::totalCount(std::unique_lock<std::mutex>& 
/*rResultSetGuard*/)
     {
         getData();
         return maResults.size();
@@ -95,7 +95,7 @@ namespace cmis
         return mbCountFinal;
     }
 
-    uno::Reference< sdbc::XRow > DataSupplier::queryPropertyValues( sal_uInt32 
nIndex  )
+    uno::Reference< sdbc::XRow > DataSupplier::queryPropertyValues( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex  )
     {
         if ( nIndex < maResults.size() )
         {
@@ -107,10 +107,10 @@ namespace cmis
             }
         }
 
-        if ( !getResult( nIndex ) )
+        if ( !getResult( rResultSetGuard, nIndex ) )
             return {};
 
-        uno::Reference< ucb::XContent > xContent( queryContent( nIndex ) );
+        uno::Reference< ucb::XContent > xContent( queryContent( 
rResultSetGuard, nIndex ) );
         if ( !xContent )
             return {};
         try
diff --git a/ucb/source/ucp/cmis/cmis_datasupplier.hxx 
b/ucb/source/ucp/cmis/cmis_datasupplier.hxx
index 35d5429ec612..fcb1b01cde65 100644
--- a/ucb/source/ucp/cmis/cmis_datasupplier.hxx
+++ b/ucb/source/ucp/cmis/cmis_datasupplier.hxx
@@ -44,20 +44,20 @@ namespace cmis
 
             virtual ~DataSupplier() override;
 
-            virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) 
override;
+            virtual OUString queryContentIdentifierString( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
             virtual css::uno::Reference< css::ucb::XContentIdentifier >
-                queryContentIdentifier( sal_uInt32 nIndex ) override;
+                queryContentIdentifier( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex ) override;
             virtual css::uno::Reference< css::ucb::XContent >
-                queryContent( sal_uInt32 nIndex ) override;
+                queryContent( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) override;
 
-            virtual bool getResult( sal_uInt32 nIndex ) override;
+            virtual bool getResult( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex ) override;
 
-            virtual sal_uInt32 totalCount() override;
+            virtual sal_uInt32 totalCount(std::unique_lock<std::mutex>& 
rResultSetGuard) override;
             virtual sal_uInt32 currentCount() override;
             virtual bool isCountFinal() override;
 
             virtual css::uno::Reference< css::sdbc::XRow >
-                queryPropertyValues( sal_uInt32 nIndex  ) override;
+                queryPropertyValues( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex  ) override;
             virtual void releasePropertyValues( sal_uInt32 nIndex ) override;
 
             virtual void close() override;
diff --git a/ucb/source/ucp/ext/ucpext_datasupplier.cxx 
b/ucb/source/ucp/ext/ucpext_datasupplier.cxx
index 739a86afa837..43cb35759819 100644
--- a/ucb/source/ucp/ext/ucpext_datasupplier.cxx
+++ b/ucb/source/ucp/ext/ucpext_datasupplier.cxx
@@ -149,7 +149,7 @@ namespace ucb::ucp::ext
     }
 
 
-    OUString DataSupplier::queryContentIdentifierString( sal_uInt32 i_nIndex )
+    OUString DataSupplier::queryContentIdentifierString( 
std::unique_lock<std::mutex>& /*rResultSetGuard*/, sal_uInt32 i_nIndex )
     {
         std::unique_lock aGuard( m_aMutex );
 
@@ -165,7 +165,7 @@ namespace ucb::ucp::ext
     }
 
 
-    Reference< XContentIdentifier > DataSupplier::queryContentIdentifier( 
sal_uInt32 i_nIndex )
+    Reference< XContentIdentifier > DataSupplier::queryContentIdentifier( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 i_nIndex )
     {
         std::unique_lock aGuard( m_aMutex );
 
@@ -176,7 +176,7 @@ namespace ucb::ucp::ext
                 return xId;
         }
 
-        OUString sId = queryContentIdentifierString( i_nIndex );
+        OUString sId = queryContentIdentifierString( rResultSetGuard, i_nIndex 
);
         if ( !sId.isEmpty() )
         {
             Reference< XContentIdentifier > xId = new 
::ucbhelper::ContentIdentifier( sId );
@@ -188,7 +188,7 @@ namespace ucb::ucp::ext
     }
 
 
-    Reference< XContent > DataSupplier::queryContent( sal_uInt32 i_nIndex )
+    Reference< XContent > DataSupplier::queryContent( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 i_nIndex )
     {
         std::unique_lock aGuard( m_aMutex );
         ENSURE_OR_RETURN( i_nIndex < m_aResults.size(), "illegal index!", 
nullptr );
@@ -198,7 +198,7 @@ namespace ucb::ucp::ext
         if ( pContent.is() )
             return pContent;
 
-        Reference< XContentIdentifier > xId( queryContentIdentifier( i_nIndex 
) );
+        Reference< XContentIdentifier > xId( queryContentIdentifier( 
rResultSetGuard, i_nIndex ) );
         if ( xId.is() )
         {
             try
@@ -220,7 +220,7 @@ namespace ucb::ucp::ext
     }
 
 
-    bool DataSupplier::getResult( sal_uInt32 i_nIndex )
+    bool DataSupplier::getResult( std::unique_lock<std::mutex>& 
/*rResultSetGuard*/, sal_uInt32 i_nIndex )
     {
         std::unique_lock aGuard( m_aMutex );
 
@@ -229,7 +229,7 @@ namespace ucb::ucp::ext
     }
 
 
-    sal_uInt32 DataSupplier::totalCount()
+    sal_uInt32 DataSupplier::totalCount(std::unique_lock<std::mutex>& 
/*rResultSetGuard*/)
     {
         std::unique_lock aGuard( m_aMutex );
         return m_aResults.size();
@@ -248,7 +248,7 @@ namespace ucb::ucp::ext
     }
 
 
-    Reference< XRow > DataSupplier::queryPropertyValues( sal_uInt32 i_nIndex  )
+    Reference< XRow > DataSupplier::queryPropertyValues( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 i_nIndex  )
     {
         std::unique_lock aGuard( m_aMutex );
         ENSURE_OR_RETURN( i_nIndex < m_aResults.size(), 
"DataSupplier::queryPropertyValues: illegal index!", nullptr );
@@ -257,7 +257,7 @@ namespace ucb::ucp::ext
         if ( xRow.is() )
             return xRow;
 
-        ENSURE_OR_RETURN( queryContent( i_nIndex ).is(), "could not retrieve 
the content", nullptr );
+        ENSURE_OR_RETURN( queryContent( rResultSetGuard, i_nIndex ).is(), 
"could not retrieve the content", nullptr );
 
         switch ( m_xContent->getExtensionContentType() )
         {
diff --git a/ucb/source/ucp/ext/ucpext_datasupplier.hxx 
b/ucb/source/ucp/ext/ucpext_datasupplier.hxx
index a7198fc9ba3b..806c55549550 100644
--- a/ucb/source/ucp/ext/ucpext_datasupplier.hxx
+++ b/ucb/source/ucp/ext/ucpext_datasupplier.hxx
@@ -50,17 +50,17 @@ namespace ucb::ucp::ext
     protected:
         virtual ~DataSupplier() override;
 
-        virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) 
override;
-        virtual css::uno::Reference< css::ucb::XContentIdentifier > 
queryContentIdentifier( sal_uInt32 nIndex ) override;
-        virtual css::uno::Reference< css::ucb::XContent > queryContent( 
sal_uInt32 nIndex ) override;
+        virtual OUString queryContentIdentifierString( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
+        virtual css::uno::Reference< css::ucb::XContentIdentifier > 
queryContentIdentifier( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) override;
+        virtual css::uno::Reference< css::ucb::XContent > queryContent( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
 
-        virtual bool getResult( sal_uInt32 nIndex ) override;
+        virtual bool getResult( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) override;
 
-        virtual sal_uInt32 totalCount() override;
+        virtual sal_uInt32 totalCount(std::unique_lock<std::mutex>& 
rResultSetGuard) override;
         virtual sal_uInt32 currentCount() override;
         virtual bool isCountFinal() override;
 
-        virtual css::uno::Reference< css::sdbc::XRow > queryPropertyValues( 
sal_uInt32 nIndex  ) override;
+        virtual css::uno::Reference< css::sdbc::XRow > queryPropertyValues( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex  ) override;
         virtual void releasePropertyValues( sal_uInt32 nIndex ) override;
 
         virtual void close() override;
diff --git a/ucb/source/ucp/gio/gio_datasupplier.cxx 
b/ucb/source/ucp/gio/gio_datasupplier.cxx
index 7f5c453c8307..5586935fcfe6 100644
--- a/ucb/source/ucp/gio/gio_datasupplier.cxx
+++ b/ucb/source/ucp/gio/gio_datasupplier.cxx
@@ -81,7 +81,7 @@ DataSupplier::~DataSupplier()
 {
 }
 
-OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
+OUString DataSupplier::queryContentIdentifierString( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex )
 {
     if ( nIndex < maResults.size() )
     {
@@ -93,7 +93,7 @@ OUString DataSupplier::queryContentIdentifierString( 
sal_uInt32 nIndex )
         }
     }
 
-    if ( getResult( nIndex ) )
+    if ( getResult( rResultSetGuard, nIndex ) )
     {
         GFile *pFile = mxContent->getGFile();
         char* parent = g_file_get_uri(pFile);
@@ -117,7 +117,7 @@ OUString DataSupplier::queryContentIdentifierString( 
sal_uInt32 nIndex )
     return OUString();
 }
 
-css::uno::Reference< css::ucb::XContentIdentifier > 
DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
+css::uno::Reference< css::ucb::XContentIdentifier > 
DataSupplier::queryContentIdentifier( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex )
 {
     if ( nIndex < maResults.size() )
     {
@@ -129,7 +129,7 @@ css::uno::Reference< css::ucb::XContentIdentifier > 
DataSupplier::queryContentId
         }
     }
 
-    OUString aId = queryContentIdentifierString( nIndex );
+    OUString aId = queryContentIdentifierString( rResultSetGuard, nIndex );
     if ( aId.getLength() )
     {
         css::uno::Reference< css::ucb::XContentIdentifier > xId = new 
ucbhelper::ContentIdentifier( aId );
@@ -140,7 +140,7 @@ css::uno::Reference< css::ucb::XContentIdentifier > 
DataSupplier::queryContentId
     return css::uno::Reference< css::ucb::XContentIdentifier >();
 }
 
-css::uno::Reference< css::ucb::XContent > DataSupplier::queryContent( 
sal_uInt32 nIndex )
+css::uno::Reference< css::ucb::XContent > DataSupplier::queryContent( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex )
 {
     if ( nIndex < maResults.size() )
     {
@@ -152,7 +152,7 @@ css::uno::Reference< css::ucb::XContent > 
DataSupplier::queryContent( sal_uInt32
         }
     }
 
-    css::uno::Reference< css::ucb::XContentIdentifier > xId = 
queryContentIdentifier( nIndex );
+    css::uno::Reference< css::ucb::XContentIdentifier > xId = 
queryContentIdentifier( rResultSetGuard, nIndex );
     if ( xId.is() )
     {
         try
@@ -168,7 +168,7 @@ css::uno::Reference< css::ucb::XContent > 
DataSupplier::queryContent( sal_uInt32
     return css::uno::Reference< css::ucb::XContent >();
 }
 
-bool DataSupplier::getResult( sal_uInt32 nIndex )
+bool DataSupplier::getResult( std::unique_lock<std::mutex>& 
/*rResultSetGuard*/, sal_uInt32 nIndex )
 {
     if ( maResults.size() > nIndex ) // Result already present.
         return true;
@@ -179,7 +179,7 @@ bool DataSupplier::getResult( sal_uInt32 nIndex )
     return false;
 }
 
-sal_uInt32 DataSupplier::totalCount()
+sal_uInt32 DataSupplier::totalCount(std::unique_lock<std::mutex>& 
/*rResultSetGuard*/)
 {
     getData();
     return maResults.size();
@@ -195,7 +195,7 @@ bool DataSupplier::isCountFinal()
     return mbCountFinal;
 }
 
-css::uno::Reference< css::sdbc::XRow > DataSupplier::queryPropertyValues( 
sal_uInt32 nIndex  )
+css::uno::Reference< css::sdbc::XRow > DataSupplier::queryPropertyValues( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex  )
 {
     if ( nIndex < maResults.size() )
     {
@@ -207,10 +207,10 @@ css::uno::Reference< css::sdbc::XRow > 
DataSupplier::queryPropertyValues( sal_uI
         }
     }
 
-    if ( !getResult( nIndex ) )
+    if ( !getResult( rResultSetGuard, nIndex ) )
         return {};
 
-    css::uno::Reference< css::ucb::XContent > xContent( queryContent( nIndex ) 
);
+    css::uno::Reference< css::ucb::XContent > xContent( queryContent( 
rResultSetGuard, nIndex ) );
     if ( !xContent )
         return {};
 
diff --git a/ucb/source/ucp/gio/gio_datasupplier.hxx 
b/ucb/source/ucp/gio/gio_datasupplier.hxx
index e2ca1d8277e7..86037d166052 100644
--- a/ucb/source/ucp/gio/gio_datasupplier.hxx
+++ b/ucb/source/ucp/gio/gio_datasupplier.hxx
@@ -62,20 +62,20 @@ public:
     DataSupplier( rtl::Reference< Content > xContent, sal_Int32 nOpenMode );
     virtual ~DataSupplier() override;
 
-    virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) 
override;
+    virtual OUString queryContentIdentifierString( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
     virtual css::uno::Reference< css::ucb::XContentIdentifier >
-        queryContentIdentifier( sal_uInt32 nIndex ) override;
+        queryContentIdentifier( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) override;
     virtual css::uno::Reference< css::ucb::XContent >
-        queryContent( sal_uInt32 nIndex ) override;
+        queryContent( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) override;
 
-    virtual bool getResult( sal_uInt32 nIndex ) override;
+    virtual bool getResult( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) override;
 
-    virtual sal_uInt32 totalCount() override;
+    virtual sal_uInt32 totalCount(std::unique_lock<std::mutex>& 
rResultSetGuard) override;
     virtual sal_uInt32 currentCount() override;
     virtual bool isCountFinal() override;
 
     virtual css::uno::Reference< css::sdbc::XRow >
-        queryPropertyValues( sal_uInt32 nIndex  ) override;
+        queryPropertyValues( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex  ) override;
     virtual void releasePropertyValues( sal_uInt32 nIndex ) override;
 
     virtual void close() override;
diff --git a/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx 
b/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx
index 1a2f29f6b30c..387f91a670e1 100644
--- a/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx
@@ -58,13 +58,15 @@ 
HierarchyResultSetDataSupplier::~HierarchyResultSetDataSupplier()
 
 // virtual
 OUString HierarchyResultSetDataSupplier::queryContentIdentifierString(
+                                                        
std::unique_lock<std::mutex>& rResultSetGuard,
                                                         sal_uInt32 nIndex )
 {
     std::unique_lock aGuard( m_aMutex );
-    return queryContentIdentifierStringImpl(aGuard, nIndex);
+    return queryContentIdentifierStringImpl(rResultSetGuard, aGuard, nIndex);
 }
 
 OUString HierarchyResultSetDataSupplier::queryContentIdentifierStringImpl(
+                                            std::unique_lock<std::mutex>& 
rResultSetGuard,
                                             std::unique_lock<std::mutex>& 
rGuard,
                                             sal_uInt32 nIndex )
 {
@@ -78,7 +80,7 @@ OUString 
HierarchyResultSetDataSupplier::queryContentIdentifierStringImpl(
         }
     }
 
-    if ( getResultImpl( rGuard, nIndex ) )
+    if ( getResultImpl( rResultSetGuard, rGuard, nIndex ) )
     {
         OUString aId
             = m_xContent->getIdentifier()->getContentIdentifier();
@@ -97,7 +99,7 @@ OUString 
HierarchyResultSetDataSupplier::queryContentIdentifierStringImpl(
 
 // virtual
 uno::Reference< ucb::XContentIdentifier >
-HierarchyResultSetDataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
+HierarchyResultSetDataSupplier::queryContentIdentifier( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex )
 {
     std::unique_lock aGuard( m_aMutex );
 
@@ -112,7 +114,7 @@ HierarchyResultSetDataSupplier::queryContentIdentifier( 
sal_uInt32 nIndex )
         }
     }
 
-    OUString aId = queryContentIdentifierStringImpl( aGuard, nIndex );
+    OUString aId = queryContentIdentifierStringImpl( rResultSetGuard, aGuard, 
nIndex );
     if ( !aId.isEmpty() )
     {
         uno::Reference< ucb::XContentIdentifier > xId
@@ -126,7 +128,7 @@ HierarchyResultSetDataSupplier::queryContentIdentifier( 
sal_uInt32 nIndex )
 
 // virtual
 uno::Reference< ucb::XContent >
-HierarchyResultSetDataSupplier::queryContent( sal_uInt32 nIndex )
+HierarchyResultSetDataSupplier::queryContent( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex )
 {
     std::unique_lock aGuard( m_aMutex );
 
@@ -142,7 +144,7 @@ HierarchyResultSetDataSupplier::queryContent( sal_uInt32 
nIndex )
     }
 
     uno::Reference< ucb::XContentIdentifier > xId
-        = queryContentIdentifier( nIndex );
+        = queryContentIdentifier( rResultSetGuard, nIndex );
     if ( xId.is() )
     {
         try
@@ -162,13 +164,13 @@ HierarchyResultSetDataSupplier::queryContent( sal_uInt32 
nIndex )
 
 
 // virtual
-bool HierarchyResultSetDataSupplier::getResult( sal_uInt32 nIndex )
+bool HierarchyResultSetDataSupplier::getResult( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex )
 {
     std::unique_lock aGuard( m_aMutex );
-    return getResultImpl(aGuard, nIndex);
+    return getResultImpl(rResultSetGuard, aGuard, nIndex);
 }
 
-bool HierarchyResultSetDataSupplier::getResultImpl( 
std::unique_lock<std::mutex>& rGuard, sal_uInt32 nIndex )
+bool HierarchyResultSetDataSupplier::getResultImpl( 
std::unique_lock<std::mutex>& rResultSetGuard, std::unique_lock<std::mutex>& 
rGuard, sal_uInt32 nIndex )
 {
     if ( m_aResults.size() > nIndex )
     {
@@ -214,11 +216,11 @@ bool HierarchyResultSetDataSupplier::getResultImpl( 
std::unique_lock<std::mutex>
         rGuard.unlock();
 
         if ( nOldCount < m_aResults.size() )
-            xResultSet->rowCountChanged(
+            xResultSet->rowCountChanged(rResultSetGuard,
                                     nOldCount, m_aResults.size() );
 
         if ( m_bCountFinal )
-            xResultSet->rowCountFinal();
+            xResultSet->rowCountFinal(rResultSetGuard);
 
         rGuard.lock();
     }
@@ -228,7 +230,7 @@ bool HierarchyResultSetDataSupplier::getResultImpl( 
std::unique_lock<std::mutex>
 
 
 // virtual
-sal_uInt32 HierarchyResultSetDataSupplier::totalCount()
+sal_uInt32 
HierarchyResultSetDataSupplier::totalCount(std::unique_lock<std::mutex>& 
rResultSetGuard)
 {
     std::unique_lock aGuard( m_aMutex );
 
@@ -253,10 +255,10 @@ sal_uInt32 HierarchyResultSetDataSupplier::totalCount()
         aGuard.unlock();
 
         if ( nOldCount < m_aResults.size() )
-            xResultSet->rowCountChanged(
+            xResultSet->rowCountChanged(rResultSetGuard,
                                     nOldCount, m_aResults.size() );
 
-        xResultSet->rowCountFinal();
+        xResultSet->rowCountFinal(rResultSetGuard);
     }
 
     return m_aResults.size();
@@ -279,7 +281,7 @@ bool HierarchyResultSetDataSupplier::isCountFinal()
 
 // virtual
 uno::Reference< sdbc::XRow >
-HierarchyResultSetDataSupplier::queryPropertyValues( sal_uInt32 nIndex  )
+HierarchyResultSetDataSupplier::queryPropertyValues( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex  )
 {
     std::unique_lock aGuard( m_aMutex );
 
@@ -294,7 +296,7 @@ HierarchyResultSetDataSupplier::queryPropertyValues( 
sal_uInt32 nIndex  )
         }
     }
 
-    if ( getResultImpl( aGuard, nIndex ) )
+    if ( getResultImpl( rResultSetGuard, aGuard, nIndex ) )
     {
         HierarchyContentProperties aData(
             m_aResults[ nIndex ]->aData );
@@ -306,7 +308,7 @@ HierarchyResultSetDataSupplier::queryPropertyValues( 
sal_uInt32 nIndex  )
                 aData,
                 static_cast< HierarchyContentProvider * >(
                     m_xContent->getProvider().get() ),
-                queryContentIdentifierStringImpl( aGuard, nIndex ) );
+                queryContentIdentifierStringImpl( rResultSetGuard, aGuard, 
nIndex ) );
         m_aResults[ nIndex ]->xRow = xRow;
         return xRow;
     }
diff --git a/ucb/source/ucp/hierarchy/hierarchydatasupplier.hxx 
b/ucb/source/ucp/hierarchy/hierarchydatasupplier.hxx
index ee416e71c5f3..8d624cb36def 100644
--- a/ucb/source/ucp/hierarchy/hierarchydatasupplier.hxx
+++ b/ucb/source/ucp/hierarchy/hierarchydatasupplier.hxx
@@ -44,28 +44,28 @@ public:
                     sal_Int32 nOpenMode );
     virtual ~HierarchyResultSetDataSupplier() override;
 
-    virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) final 
override;
+    virtual OUString queryContentIdentifierString( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) final 
override;
     virtual css::uno::Reference< css::ucb::XContentIdentifier >
-    queryContentIdentifier( sal_uInt32 nIndex ) override;
+    queryContentIdentifier( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) override;
     virtual css::uno::Reference< css::ucb::XContent >
-    queryContent( sal_uInt32 nIndex ) override;
+    queryContent( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 
nIndex ) override;
 
-    virtual bool getResult( sal_uInt32 nIndex ) final override;
+    virtual bool getResult( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) final override;
 
-    virtual sal_uInt32 totalCount() override;
+    virtual sal_uInt32 totalCount(std::unique_lock<std::mutex>& 
rResultSetGuard) override;
     virtual sal_uInt32 currentCount() override;
     virtual bool isCountFinal() override;
 
     virtual css::uno::Reference< css::sdbc::XRow >
-    queryPropertyValues( sal_uInt32 nIndex  ) override;
+    queryPropertyValues( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex  ) override;
     virtual void releasePropertyValues( sal_uInt32 nIndex ) override;
 
     virtual void close() override;
 
     virtual void validate() override;
 private:
-    OUString queryContentIdentifierStringImpl( std::unique_lock<std::mutex>&, 
sal_uInt32 nIndex );
-    bool getResultImpl( std::unique_lock<std::mutex>&, sal_uInt32 nIndex );
+    OUString queryContentIdentifierStringImpl( std::unique_lock<std::mutex>& 
rResultSetGuard, std::unique_lock<std::mutex>&, sal_uInt32 nIndex );
+    bool getResultImpl( std::unique_lock<std::mutex>& rResultSetGuard, 
std::unique_lock<std::mutex>&, sal_uInt32 nIndex );
 
     struct ResultListEntry
     {
diff --git a/ucb/source/ucp/package/pkgdatasupplier.cxx 
b/ucb/source/ucp/package/pkgdatasupplier.cxx
index 1da67d26b3e9..a1660b41d6c9 100644
--- a/ucb/source/ucp/package/pkgdatasupplier.cxx
+++ b/ucb/source/ucp/package/pkgdatasupplier.cxx
@@ -60,13 +60,13 @@ DataSupplier::~DataSupplier()
 
 
 // virtual
-OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
+OUString DataSupplier::queryContentIdentifierString( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex )
 {
     std::unique_lock aGuard( m_aMutex );
-    return queryContentIdentifierStringImpl(aGuard, nIndex);
+    return queryContentIdentifierStringImpl(rResultSetGuard, aGuard, nIndex);
 }
 
-OUString DataSupplier::queryContentIdentifierStringImpl( 
std::unique_lock<std::mutex>& rGuard, sal_uInt32 nIndex )
+OUString DataSupplier::queryContentIdentifierStringImpl( 
std::unique_lock<std::mutex>& rResultSetGuard, std::unique_lock<std::mutex>& 
rGuard, sal_uInt32 nIndex )
 {
     if ( nIndex < m_aResults.size() )
     {
@@ -78,7 +78,7 @@ OUString DataSupplier::queryContentIdentifierStringImpl( 
std::unique_lock<std::m
         }
     }
 
-    if ( getResultImpl( rGuard, nIndex ) )
+    if ( getResultImpl( rResultSetGuard, rGuard, nIndex ) )
     {
         // Note: getResult fills m_aResults[ nIndex ].aURL.
         return m_aResults[ nIndex ].aURL;
@@ -89,14 +89,14 @@ OUString DataSupplier::queryContentIdentifierStringImpl( 
std::unique_lock<std::m
 
 // virtual
 uno::Reference< ucb::XContentIdentifier >
-DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
+DataSupplier::queryContentIdentifier( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex )
 {
     std::unique_lock aGuard( m_aMutex );
-    return queryContentIdentifierImpl(aGuard, nIndex);
+    return queryContentIdentifierImpl(rResultSetGuard, aGuard, nIndex);
 }
 
 uno::Reference< ucb::XContentIdentifier >
-DataSupplier::queryContentIdentifierImpl( std::unique_lock<std::mutex>& 
rGuard, sal_uInt32 nIndex )
+DataSupplier::queryContentIdentifierImpl( std::unique_lock<std::mutex>& 
rResultSetGuard, std::unique_lock<std::mutex>& rGuard, sal_uInt32 nIndex )
 {
     if ( nIndex < m_aResults.size() )
     {
@@ -109,7 +109,7 @@ DataSupplier::queryContentIdentifierImpl( 
std::unique_lock<std::mutex>& rGuard,
         }
     }
 
-    OUString aId = queryContentIdentifierStringImpl( rGuard, nIndex );
+    OUString aId = queryContentIdentifierStringImpl( rResultSetGuard, rGuard, 
nIndex );
     if ( !aId.isEmpty() )
     {
         uno::Reference< ucb::XContentIdentifier > xId
@@ -123,6 +123,7 @@ DataSupplier::queryContentIdentifierImpl( 
std::unique_lock<std::mutex>& rGuard,
 
 // virtual
 uno::Reference< ucb::XContent > DataSupplier::queryContent(
+                                                        
std::unique_lock<std::mutex>& rResultSetGuard,
                                                         sal_uInt32 nIndex )
 {
     std::unique_lock aGuard( m_aMutex );
@@ -139,7 +140,7 @@ uno::Reference< ucb::XContent > DataSupplier::queryContent(
     }
 
     uno::Reference< ucb::XContentIdentifier > xId
-        = queryContentIdentifierImpl( aGuard, nIndex );
+        = queryContentIdentifierImpl( rResultSetGuard, aGuard, nIndex );
     if ( xId.is() )
     {
         try
@@ -159,13 +160,13 @@ uno::Reference< ucb::XContent > 
DataSupplier::queryContent(
 
 
 // virtual
-bool DataSupplier::getResult( sal_uInt32 nIndex )
+bool DataSupplier::getResult( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex )
 {
     std::unique_lock aGuard( m_aMutex );
-    return getResultImpl(aGuard, nIndex);
+    return getResultImpl(rResultSetGuard, aGuard, nIndex);
 }
 
-bool DataSupplier::getResultImpl( std::unique_lock<std::mutex>& rGuard, 
sal_uInt32 nIndex )
+bool DataSupplier::getResultImpl( std::unique_lock<std::mutex>& 
rResultSetGuard, std::unique_lock<std::mutex>& rGuard, sal_uInt32 nIndex )
 {
     if ( m_aResults.size() > nIndex )
     {
@@ -241,11 +242,11 @@ bool DataSupplier::getResultImpl( 
std::unique_lock<std::mutex>& rGuard, sal_uInt
         rGuard.unlock();
 
         if ( nOldCount < m_aResults.size() )
-            xResultSet->rowCountChanged(
+            xResultSet->rowCountChanged(rResultSetGuard,
                                     nOldCount, m_aResults.size() );
 
         if ( m_bCountFinal )
-            xResultSet->rowCountFinal();
+            xResultSet->rowCountFinal(rResultSetGuard);
 
         rGuard.lock();
     }
@@ -255,7 +256,7 @@ bool DataSupplier::getResultImpl( 
std::unique_lock<std::mutex>& rGuard, sal_uInt
 
 
 // virtual
-sal_uInt32 DataSupplier::totalCount()
+sal_uInt32 DataSupplier::totalCount(std::unique_lock<std::mutex>& 
rResultSetGuard)
 {
     std::unique_lock aGuard( m_aMutex );
 
@@ -311,10 +312,10 @@ sal_uInt32 DataSupplier::totalCount()
         aGuard.unlock();
 
         if ( nOldCount < m_aResults.size() )
-            xResultSet->rowCountChanged(
+            xResultSet->rowCountChanged(rResultSetGuard,
                                     nOldCount, m_aResults.size() );
 
-        xResultSet->rowCountFinal();
+        xResultSet->rowCountFinal(rResultSetGuard);
     }
 
     return m_aResults.size();
@@ -337,6 +338,7 @@ bool DataSupplier::isCountFinal()
 
 // virtual
 uno::Reference< sdbc::XRow > DataSupplier::queryPropertyValues(
+                                                        
std::unique_lock<std::mutex>& rResultSetGuard,
                                                         sal_uInt32 nIndex  )
 {
     std::unique_lock aGuard( m_aMutex );
@@ -351,14 +353,14 @@ uno::Reference< sdbc::XRow > 
DataSupplier::queryPropertyValues(
         }
     }
 
-    if ( getResultImpl( aGuard, nIndex ) )
+    if ( getResultImpl( rResultSetGuard, aGuard, nIndex ) )
     {
         uno::Reference< sdbc::XRow > xRow = Content::getPropertyValues(
                         m_xContext,
                         getResultSet()->getProperties(),
                         static_cast< ContentProvider * >(
                             m_xContent->getProvider().get() ),
-                        queryContentIdentifierStringImpl( aGuard, nIndex ) );
+                        queryContentIdentifierStringImpl( rResultSetGuard, 
aGuard, nIndex ) );
         m_aResults[ nIndex ].xRow = xRow;
         return xRow;
     }
diff --git a/ucb/source/ucp/package/pkgdatasupplier.hxx 
b/ucb/source/ucp/package/pkgdatasupplier.hxx
index 1872ef26e470..49c9912fdf15 100644
--- a/ucb/source/ucp/package/pkgdatasupplier.hxx
+++ b/ucb/source/ucp/package/pkgdatasupplier.hxx
@@ -37,20 +37,20 @@ public:
                   const rtl::Reference< Content >& rContent );
     virtual ~DataSupplier() override;
 
-    virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) 
override;
+    virtual OUString queryContentIdentifierString( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
     virtual css::uno::Reference< css::ucb::XContentIdentifier >
-    queryContentIdentifier( sal_uInt32 nIndex ) override;
+    queryContentIdentifier( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) override;
     virtual css::uno::Reference< css::ucb::XContent >
-    queryContent( sal_uInt32 nIndex ) override;
+    queryContent( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 
nIndex ) override;
 
-    virtual bool getResult( sal_uInt32 nIndex ) override;
+    virtual bool getResult( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) override;
 
-    virtual sal_uInt32 totalCount() override;
+    virtual sal_uInt32 totalCount(std::unique_lock<std::mutex>& 
rResultSetGuard) override;
     virtual sal_uInt32 currentCount() override;
     virtual bool isCountFinal() override;
 
     virtual css::uno::Reference< css::sdbc::XRow >
-    queryPropertyValues( sal_uInt32 nIndex  ) override;
+    queryPropertyValues( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex  ) override;
     virtual void releasePropertyValues( sal_uInt32 nIndex ) override;
 
     virtual void close() override;
@@ -60,9 +60,9 @@ public:
     OUString assembleChildURL( const OUString& aName );
 
 private:
-    bool getResultImpl( std::unique_lock<std::mutex>&, sal_uInt32 nIndex );
-    OUString queryContentIdentifierStringImpl( std::unique_lock<std::mutex>&, 
sal_uInt32 nIndex );
-    css::uno::Reference< css::ucb::XContentIdentifier > 
queryContentIdentifierImpl( std::unique_lock<std::mutex>&, sal_uInt32 nIndex );
+    bool getResultImpl( std::unique_lock<std::mutex>& rResultSetGuard, 
std::unique_lock<std::mutex>&, sal_uInt32 nIndex );
+    OUString queryContentIdentifierStringImpl( std::unique_lock<std::mutex>& 
rResultSetGuard, std::unique_lock<std::mutex>&, sal_uInt32 nIndex );
+    css::uno::Reference< css::ucb::XContentIdentifier > 
queryContentIdentifierImpl( std::unique_lock<std::mutex>& rResultSetGuard, 
std::unique_lock<std::mutex>&, sal_uInt32 nIndex );
 
     struct ResultListEntry
     {
diff --git a/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx 
b/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx
index 272349bd6e46..54d108704eda 100644
--- a/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx
@@ -70,14 +70,14 @@ ResultSetDataSupplier::~ResultSetDataSupplier()
 
 // virtual
 OUString
-ResultSetDataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
+ResultSetDataSupplier::queryContentIdentifierString( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex )
 {
     std::unique_lock aGuard( m_aMutex );
-    return queryContentIdentifierStringImpl(aGuard, nIndex);
+    return queryContentIdentifierStringImpl(rResultSetGuard, aGuard, nIndex);
 }
 
 OUString
-ResultSetDataSupplier::queryContentIdentifierStringImpl( 
std::unique_lock<std::mutex>& rGuard, sal_uInt32 nIndex )
+ResultSetDataSupplier::queryContentIdentifierStringImpl( 
std::unique_lock<std::mutex>& rResultSetGuard, std::unique_lock<std::mutex>& 
rGuard, sal_uInt32 nIndex )
 {
     if ( nIndex < m_aResults.size() )
     {
@@ -89,7 +89,7 @@ ResultSetDataSupplier::queryContentIdentifierStringImpl( 
std::unique_lock<std::m
         }
     }
 
-    if ( getResultImpl(rGuard, nIndex) )
+    if ( getResultImpl(rResultSetGuard, rGuard, nIndex) )
     {
         // Note: getResult fills m_pImpl->m_aResults[ nIndex ]->aURL.
         return m_aResults[ nIndex ].aURL;
@@ -99,14 +99,14 @@ ResultSetDataSupplier::queryContentIdentifierStringImpl( 
std::unique_lock<std::m
 
 // virtual
 uno::Reference< ucb::XContentIdentifier >
-ResultSetDataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
+ResultSetDataSupplier::queryContentIdentifier( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex )
 {
     std::unique_lock aGuard( m_aMutex );
-    return queryContentIdentifierImpl(aGuard, nIndex);
+    return queryContentIdentifierImpl(rResultSetGuard, aGuard, nIndex);
 }
 
 uno::Reference< ucb::XContentIdentifier >
-ResultSetDataSupplier::queryContentIdentifierImpl( 
std::unique_lock<std::mutex>& rGuard, sal_uInt32 nIndex )
+ResultSetDataSupplier::queryContentIdentifierImpl( 
std::unique_lock<std::mutex>& rResultSetGuard, std::unique_lock<std::mutex>& 
rGuard, sal_uInt32 nIndex )
 {
     if ( nIndex < m_aResults.size() )
     {
@@ -119,7 +119,7 @@ ResultSetDataSupplier::queryContentIdentifierImpl( 
std::unique_lock<std::mutex>&
         }
     }
 
-    OUString aId = queryContentIdentifierStringImpl( rGuard, nIndex );
+    OUString aId = queryContentIdentifierStringImpl( rResultSetGuard, rGuard, 
nIndex );
     if ( !aId.isEmpty() )
     {
         uno::Reference< ucb::XContentIdentifier > xId
@@ -132,7 +132,7 @@ ResultSetDataSupplier::queryContentIdentifierImpl( 
std::unique_lock<std::mutex>&
 
 // virtual
 uno::Reference< ucb::XContent >
-ResultSetDataSupplier::queryContent( sal_uInt32 nIndex )
+ResultSetDataSupplier::queryContent( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex )
 {
     std::unique_lock aGuard( m_aMutex );
 
@@ -148,7 +148,7 @@ ResultSetDataSupplier::queryContent( sal_uInt32 nIndex )
     }
 
     uno::Reference< ucb::XContentIdentifier > xId
-        = queryContentIdentifierImpl( aGuard, nIndex );
+        = queryContentIdentifierImpl( rResultSetGuard, aGuard, nIndex );
     if ( xId.is() )
     {
         try
@@ -167,13 +167,13 @@ ResultSetDataSupplier::queryContent( sal_uInt32 nIndex )
 }
 
 // virtual
-bool ResultSetDataSupplier::getResult( sal_uInt32 nIndex )
+bool ResultSetDataSupplier::getResult( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex )
 {
     std::unique_lock aGuard( m_aMutex );
-    return getResultImpl(aGuard, nIndex);
+    return getResultImpl(rResultSetGuard, aGuard, nIndex);
 }
 
-bool ResultSetDataSupplier::getResultImpl( std::unique_lock<std::mutex>& 
rGuard, sal_uInt32 nIndex )
+bool ResultSetDataSupplier::getResultImpl( std::unique_lock<std::mutex>& 
rResultSetGuard, std::unique_lock<std::mutex>& rGuard, sal_uInt32 nIndex )
 {
     if ( m_aResults.size() > nIndex )
     {
@@ -231,10 +231,10 @@ bool ResultSetDataSupplier::getResultImpl( 
std::unique_lock<std::mutex>& rGuard,
         rGuard.unlock();
 
         if ( nOldCount < m_aResults.size() )
-            xResultSet->rowCountChanged( nOldCount, m_aResults.size() );
+            xResultSet->rowCountChanged( rResultSetGuard, nOldCount, 
m_aResults.size() );
 
         if ( m_bCountFinal )
-            xResultSet->rowCountFinal();
+            xResultSet->rowCountFinal(rResultSetGuard);
 
         rGuard.lock();
     }
@@ -243,7 +243,7 @@ bool ResultSetDataSupplier::getResultImpl( 
std::unique_lock<std::mutex>& rGuard,
 }
 
 // virtual
-sal_uInt32 ResultSetDataSupplier::totalCount()
+sal_uInt32 ResultSetDataSupplier::totalCount(std::unique_lock<std::mutex>& 
rResultSetGuard)
 {
     std::unique_lock aGuard( m_aMutex );
 
@@ -284,9 +284,9 @@ sal_uInt32 ResultSetDataSupplier::totalCount()
         aGuard.unlock();
 
         if ( nOldCount < m_aResults.size() )
-            xResultSet->rowCountChanged( nOldCount, m_aResults.size() );
+            xResultSet->rowCountChanged( rResultSetGuard, nOldCount, 
m_aResults.size() );
 
-        xResultSet->rowCountFinal();
+        xResultSet->rowCountFinal(rResultSetGuard);
     }
 
     return m_aResults.size();
@@ -306,7 +306,7 @@ bool ResultSetDataSupplier::isCountFinal()
 
 // virtual
 uno::Reference< sdbc::XRow >
-ResultSetDataSupplier::queryPropertyValues( sal_uInt32 nIndex  )
+ResultSetDataSupplier::queryPropertyValues( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex  )
 {
     std::unique_lock aGuard( m_aMutex );
 
@@ -320,13 +320,13 @@ ResultSetDataSupplier::queryPropertyValues( sal_uInt32 
nIndex  )
         }
     }
 
-    if ( getResultImpl( aGuard, nIndex ) )
+    if ( getResultImpl( rResultSetGuard, aGuard, nIndex ) )
     {
         uno::Reference< sdbc::XRow > xRow = Content::getPropertyValues(
                         m_xContext,
                         getResultSet()->getProperties(),
                         m_xContent->getContentProvider().get(),
-                        queryContentIdentifierStringImpl( aGuard, nIndex ) );
+                        queryContentIdentifierStringImpl( rResultSetGuard, 
aGuard, nIndex ) );
         m_aResults[ nIndex ].xRow = xRow;
         return xRow;
     }
diff --git a/ucb/source/ucp/tdoc/tdoc_datasupplier.hxx 
b/ucb/source/ucp/tdoc/tdoc_datasupplier.hxx
index 802a6dbc0a8c..8032e53a3a75 100644
--- a/ucb/source/ucp/tdoc/tdoc_datasupplier.hxx
+++ b/ucb/source/ucp/tdoc/tdoc_datasupplier.hxx
@@ -62,20 +62,20 @@ public:
         rtl::Reference< Content > xContent );
     virtual ~ResultSetDataSupplier() override;
 
-    virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) 
override;
+    virtual OUString queryContentIdentifierString( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
     virtual css::uno::Reference< css::ucb::XContentIdentifier >
-    queryContentIdentifier( sal_uInt32 nIndex ) override;
+    queryContentIdentifier( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) override;
     virtual css::uno::Reference< css::ucb::XContent >
-    queryContent( sal_uInt32 nIndex ) override;
+    queryContent( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 
nIndex ) override;
 
-    virtual bool getResult( sal_uInt32 nIndex ) override;
+    virtual bool getResult( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) override;
 
-    virtual sal_uInt32 totalCount() override;
+    virtual sal_uInt32 totalCount(std::unique_lock<std::mutex>& 
rResultSetGuard) override;
     virtual sal_uInt32 currentCount() override;
     virtual bool   isCountFinal() override;
 
     virtual css::uno::Reference< css::sdbc::XRow >
-    queryPropertyValues( sal_uInt32 nIndex  ) override;
+    queryPropertyValues( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex  ) override;
     virtual void releasePropertyValues( sal_uInt32 nIndex ) override;
 
     virtual void close() override;
@@ -83,10 +83,10 @@ public:
     virtual void validate() override;
 
 private:
-    OUString queryContentIdentifierStringImpl( std::unique_lock<std::mutex>& 
rGuard, sal_uInt32 nIndex );
+    OUString queryContentIdentifierStringImpl( std::unique_lock<std::mutex>& 
rResultSetGuard, std::unique_lock<std::mutex>& rGuard, sal_uInt32 nIndex );
     css::uno::Reference< css::ucb::XContentIdentifier >
-      queryContentIdentifierImpl( std::unique_lock<std::mutex>& rGuard, 
sal_uInt32 nIndex );
-    bool getResultImpl( std::unique_lock<std::mutex>& rGuard, sal_uInt32 
nIndex );
+      queryContentIdentifierImpl( std::unique_lock<std::mutex>& 
rResultSetGuard, std::unique_lock<std::mutex>& rGuard, sal_uInt32 nIndex );
+    bool getResultImpl( std::unique_lock<std::mutex>& rResultSetGuard, 
std::unique_lock<std::mutex>& rGuard, sal_uInt32 nIndex );
 };
 
 } // namespace tdoc_ucp
diff --git a/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx 
b/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx
index 7c1e0b63e7d0..14ba4b86fa2a 100644
--- a/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx
+++ b/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx
@@ -92,7 +92,7 @@ DataSupplier::~DataSupplier()
 
 
 // virtual
-OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
+OUString DataSupplier::queryContentIdentifierString( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex )
 {
     osl::Guard< osl::Mutex > aGuard( m_aMutex );
 
@@ -106,7 +106,7 @@ OUString DataSupplier::queryContentIdentifierString( 
sal_uInt32 nIndex )
         }
     }
 
-    if ( getResult( nIndex ) )
+    if ( getResult( rResultSetGuard, nIndex ) )
     {
         OUString aId = m_xContent->getResourceAccess().getURL();
 
@@ -129,7 +129,7 @@ OUString DataSupplier::queryContentIdentifierString( 
sal_uInt32 nIndex )
 
 // virtual
 uno::Reference< ucb::XContentIdentifier >
-DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
+DataSupplier::queryContentIdentifier( std::unique_lock<std::mutex>& 
rResultSetGuard, sal_uInt32 nIndex )
 {
     osl::Guard< osl::Mutex > aGuard( m_aMutex );
 
@@ -144,7 +144,7 @@ DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
         }
     }
 
-    OUString aId = queryContentIdentifierString( nIndex );
+    OUString aId = queryContentIdentifierString( rResultSetGuard, nIndex );
     if ( aId.getLength() )
     {
         uno::Reference< ucb::XContentIdentifier > xId
@@ -158,7 +158,7 @@ DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
 
 // virtual
 uno::Reference< ucb::XContent >
-DataSupplier::queryContent( sal_uInt32 nIndex )
+DataSupplier::queryContent( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex )
 {
     osl::Guard< osl::Mutex > aGuard( m_aMutex );
 
@@ -174,7 +174,7 @@ DataSupplier::queryContent( sal_uInt32 nIndex )
     }
 
     uno::Reference< ucb::XContentIdentifier > xId
-        = queryContentIdentifier( nIndex );
+        = queryContentIdentifier( rResultSetGuard, nIndex );
     if ( xId.is() )
     {
         try
@@ -194,7 +194,7 @@ DataSupplier::queryContent( sal_uInt32 nIndex )
 
 
 // virtual
-bool DataSupplier::getResult( sal_uInt32 nIndex )
+bool DataSupplier::getResult( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex )
 {
     osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
 
@@ -205,7 +205,7 @@ bool DataSupplier::getResult( sal_uInt32 nIndex )
     }
 
     // Obtain values...
-    if ( getData() )
+    if ( getData(rResultSetGuard) )
     {
         if (nIndex < m_Results.size())
         {
@@ -219,10 +219,10 @@ bool DataSupplier::getResult( sal_uInt32 nIndex )
 
 
 // virtual
-sal_uInt32 DataSupplier::totalCount()
+sal_uInt32 DataSupplier::totalCount(std::unique_lock<std::mutex>& 
rResultSetGuard)
 {
   // Obtain values...
-  getData();
+  getData(rResultSetGuard);
 
   return m_Results.size();
 }
@@ -243,7 +243,7 @@ bool DataSupplier::isCountFinal()
 
 
 // virtual
-uno::Reference< sdbc::XRow > DataSupplier::queryPropertyValues(
+uno::Reference< sdbc::XRow > 
DataSupplier::queryPropertyValues(std::unique_lock<std::mutex>& rResultSetGuard,
                                                     sal_uInt32 nIndex  )
 {
     osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -258,7 +258,7 @@ uno::Reference< sdbc::XRow > 
DataSupplier::queryPropertyValues(
         }
     }
 
-    if ( getResult( nIndex ) )
+    if ( getResult( rResultSetGuard, nIndex ) )
     {
         uno::Reference< sdbc::XRow > xRow
             = Content::getPropertyValues(
@@ -266,7 +266,7 @@ uno::Reference< sdbc::XRow > 
DataSupplier::queryPropertyValues(
                 getResultSet()->getProperties(),
                 *(m_Results[ nIndex ]->pData),
                 m_xContent->getProvider(),
-                queryContentIdentifierString( nIndex ) );
+                queryContentIdentifierString( rResultSetGuard, nIndex ) );
         m_Results[ nIndex ]->xRow = xRow;
         return xRow;
     }
@@ -298,7 +298,7 @@ void DataSupplier::validate()
         throw ucb::ResultSetException();
 }
 
-bool DataSupplier::getData()
+bool DataSupplier::getData(std::unique_lock<std::mutex>& rResultSetGuard)
 {
     osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
 
@@ -433,7 +433,7 @@ bool DataSupplier::getData()
 
         // Callback possible, because listeners may be informed!
         aGuard.clear();
-        getResultSet()->rowCountFinal();
+        getResultSet()->rowCountFinal(rResultSetGuard);
     }
     return !m_bThrowException;
 }
diff --git a/ucb/source/ucp/webdav-curl/webdavdatasupplier.hxx 
b/ucb/source/ucp/webdav-curl/webdavdatasupplier.hxx
index e1f2efba91c8..5af6bc1e5893 100644
--- a/ucb/source/ucp/webdav-curl/webdavdatasupplier.hxx
+++ b/ucb/source/ucp/webdav-curl/webdavdatasupplier.hxx
@@ -35,7 +35,7 @@ struct DAVResource;
 
 class DataSupplier : public ucbhelper::ResultSetDataSupplier
 {
-    bool getData();
+    bool getData(std::unique_lock<std::mutex>& rResultSetGuard);
 
 public:
     DataSupplier( const css::uno::Reference< css::uno::XComponentContext >& 
rxContext,
@@ -44,20 +44,20 @@ public:
 
     virtual ~DataSupplier() override;
 
-    virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) 
override;
+    virtual OUString queryContentIdentifierString( 
std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
     virtual css::uno::Reference< css::ucb::XContentIdentifier >
-    queryContentIdentifier( sal_uInt32 nIndex ) override;
+    queryContentIdentifier( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) override;
     virtual css::uno::Reference< css::ucb::XContent >
-    queryContent( sal_uInt32 nIndex ) override;
+    queryContent( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 
nIndex ) override;
 
-    virtual bool getResult( sal_uInt32 nIndex ) override;
+    virtual bool getResult( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex ) override;
 
-    virtual sal_uInt32 totalCount() override;
+    virtual sal_uInt32 totalCount(std::unique_lock<std::mutex>& 
rResultSetGuard) override;
     virtual sal_uInt32 currentCount() override;
     virtual bool isCountFinal() override;
 
     virtual css::uno::Reference< css::sdbc::XRow >
-    queryPropertyValues( sal_uInt32 nIndex  ) override;
+    queryPropertyValues( std::unique_lock<std::mutex>& rResultSetGuard, 
sal_uInt32 nIndex  ) override;
     virtual void releasePropertyValues( sal_uInt32 nIndex ) override;
 
     virtual void close() override;
diff --git a/ucbhelper/source/provider/resultset.cxx 
b/ucbhelper/source/provider/resultset.cxx
index 9783e7e0f1d5..ae246db3c375 100644
--- a/ucbhelper/source/provider/resultset.cxx
+++ b/ucbhelper/source/provider/resultset.cxx
@@ -303,7 +303,7 @@ sal_Bool SAL_CALL ResultSet::next()
     }
 
     // getResult works zero-based!
-    if ( !m_pImpl->m_xDataSupplier->getResult( m_pImpl->m_nPos ) )
+    if ( !m_pImpl->m_xDataSupplier->getResult( aGuard, m_pImpl->m_nPos ) )
     {
         m_pImpl->m_bAfterLast = true;
         m_pImpl->m_xDataSupplier->validate();
@@ -319,6 +319,7 @@ sal_Bool SAL_CALL ResultSet::next()
 // virtual
 sal_Bool SAL_CALL ResultSet::isBeforeFirst()
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
     if ( m_pImpl->m_bAfterLast )
     {
         m_pImpl->m_xDataSupplier->validate();
@@ -326,7 +327,7 @@ sal_Bool SAL_CALL ResultSet::isBeforeFirst()
     }
 
     // getResult works zero-based!
-    if ( !m_pImpl->m_xDataSupplier->getResult( 0 ) )
+    if ( !m_pImpl->m_xDataSupplier->getResult( aGuard, 0 ) )
     {
         m_pImpl->m_xDataSupplier->validate();
         return false;
@@ -340,6 +341,7 @@ sal_Bool SAL_CALL ResultSet::isBeforeFirst()
 // virtual
 sal_Bool SAL_CALL ResultSet::isAfterLast()
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
     m_pImpl->m_xDataSupplier->validate();
     return m_pImpl->m_bAfterLast;
 }
@@ -348,6 +350,7 @@ sal_Bool SAL_CALL ResultSet::isAfterLast()
 // virtual
 sal_Bool SAL_CALL ResultSet::isFirst()
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
     if ( m_pImpl->m_bAfterLast )
     {
         m_pImpl->m_xDataSupplier->validate();
@@ -362,13 +365,14 @@ sal_Bool SAL_CALL ResultSet::isFirst()
 // virtual
 sal_Bool SAL_CALL ResultSet::isLast()
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
     if ( m_pImpl->m_bAfterLast )
     {
         m_pImpl->m_xDataSupplier->validate();
         return false;
     }
 
-    sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+    sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount(aGuard);
     if ( !nCount )
     {
         m_pImpl->m_xDataSupplier->validate();
@@ -402,10 +406,11 @@ void SAL_CALL ResultSet::afterLast()
 // virtual
 sal_Bool SAL_CALL ResultSet::first()
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     // getResult works zero-based!
-    if ( m_pImpl->m_xDataSupplier->getResult( 0 ) )
+    if ( m_pImpl->m_xDataSupplier->getResult( aGuard, 0 ) )
     {
-        std::unique_lock aGuard( m_pImpl->m_aMutex );
         m_pImpl->m_bAfterLast = false;
         m_pImpl->m_nPos = 1;
         m_pImpl->m_xDataSupplier->validate();
@@ -420,10 +425,11 @@ sal_Bool SAL_CALL ResultSet::first()
 // virtual
 sal_Bool SAL_CALL ResultSet::last()
 {
-    sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
+    sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount(aGuard);
     if ( nCount )
     {
-        std::unique_lock aGuard( m_pImpl->m_aMutex );
         m_pImpl->m_bAfterLast = false;
         m_pImpl->m_nPos = nCount;
         m_pImpl->m_xDataSupplier->validate();
@@ -438,6 +444,7 @@ sal_Bool SAL_CALL ResultSet::last()
 // virtual
 sal_Int32 SAL_CALL ResultSet::getRow()
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
     if ( m_pImpl->m_bAfterLast )
     {
         m_pImpl->m_xDataSupplier->validate();
@@ -469,13 +476,14 @@ sal_Bool SAL_CALL ResultSet::absolute( sal_Int32 row )
 
     Calling absolute( -1 ) is the same as calling last().
 */
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( row < 0 )
     {
-        sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+        sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount(aGuard);
 
         if ( ( row * -1 ) > nCount )
         {
-            std::unique_lock aGuard( m_pImpl->m_aMutex );
             m_pImpl->m_bAfterLast = false;
             m_pImpl->m_nPos = 0;
             m_pImpl->m_xDataSupplier->validate();
@@ -483,7 +491,6 @@ sal_Bool SAL_CALL ResultSet::absolute( sal_Int32 row )
         }
         else // |row| <= nCount
         {
-            std::unique_lock aGuard( m_pImpl->m_aMutex );
             m_pImpl->m_bAfterLast = false;
             m_pImpl->m_nPos = ( nCount + row + 1 );
             m_pImpl->m_xDataSupplier->validate();
@@ -498,11 +505,10 @@ sal_Bool SAL_CALL ResultSet::absolute( sal_Int32 row )
     }
     else // row > 0
     {
-        sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+        sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount(aGuard);
 
         if ( row <= nCount )
         {
-            std::unique_lock aGuard( m_pImpl->m_aMutex );
             m_pImpl->m_bAfterLast = false;
             m_pImpl->m_nPos = row;
             m_pImpl->m_xDataSupplier->validate();
@@ -510,7 +516,6 @@ sal_Bool SAL_CALL ResultSet::absolute( sal_Int32 row )
         }
         else // row > nCount
         {
-            std::unique_lock aGuard( m_pImpl->m_aMutex );
             m_pImpl->m_bAfterLast = true;
             m_pImpl->m_xDataSupplier->validate();
             return false;
@@ -535,6 +540,8 @@ sal_Bool SAL_CALL ResultSet::relative( sal_Int32 rows )
     the cursor is positioned before the first row or after the last row of
     the result set.
 */
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_bAfterLast || ( m_pImpl->m_nPos == 0 ) )
     {
         // "No current row".
@@ -545,7 +552,6 @@ sal_Bool SAL_CALL ResultSet::relative( sal_Int32 rows )
     {
         if ( ( m_pImpl->m_nPos + rows ) > 0 )
         {
-            std::unique_lock aGuard( m_pImpl->m_aMutex );
             m_pImpl->m_bAfterLast = false;
             m_pImpl->m_nPos = ( m_pImpl->m_nPos + rows );
             m_pImpl->m_xDataSupplier->validate();
@@ -553,7 +559,6 @@ sal_Bool SAL_CALL ResultSet::relative( sal_Int32 rows )
         }
         else
         {
-            std::unique_lock aGuard( m_pImpl->m_aMutex );
             m_pImpl->m_bAfterLast = false;
             m_pImpl->m_nPos = 0;
             m_pImpl->m_xDataSupplier->validate();
@@ -568,10 +573,9 @@ sal_Bool SAL_CALL ResultSet::relative( sal_Int32 rows )
     }
     else // rows > 0
     {
-        sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+        sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount(aGuard);
         if ( ( m_pImpl->m_nPos + rows ) <= nCount )
         {
-            std::unique_lock aGuard( m_pImpl->m_aMutex );
             m_pImpl->m_bAfterLast = false;
             m_pImpl->m_nPos = ( m_pImpl->m_nPos + rows );
             m_pImpl->m_xDataSupplier->validate();
@@ -579,7 +583,6 @@ sal_Bool SAL_CALL ResultSet::relative( sal_Int32 rows )
         }
         else
         {
-            std::unique_lock aGuard( m_pImpl->m_aMutex );
             m_pImpl->m_bAfterLast = true;
             m_pImpl->m_xDataSupplier->validate();
             return false;
@@ -602,7 +605,7 @@ sal_Bool SAL_CALL ResultSet::previous()
     if ( m_pImpl->m_bAfterLast )
     {
         m_pImpl->m_bAfterLast = false;
-        sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+        sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount(aGuard);
         m_pImpl->m_nPos = nCount;
     }
     else if ( m_pImpl->m_nPos )
@@ -677,10 +680,12 @@ sal_Bool SAL_CALL ResultSet::wasNull()
     // threads doing a getXYZ - wasNull calling sequence on the same
     // implementation object...
 
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -697,10 +702,12 @@ sal_Bool SAL_CALL ResultSet::wasNull()
 // virtual
 OUString SAL_CALL ResultSet::getString( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -719,10 +726,12 @@ OUString SAL_CALL ResultSet::getString( sal_Int32 
columnIndex )
 // virtual
 sal_Bool SAL_CALL ResultSet::getBoolean( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -741,10 +750,12 @@ sal_Bool SAL_CALL ResultSet::getBoolean( sal_Int32 
columnIndex )
 // virtual
 sal_Int8 SAL_CALL ResultSet::getByte( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -763,10 +774,12 @@ sal_Int8 SAL_CALL ResultSet::getByte( sal_Int32 
columnIndex )
 // virtual
 sal_Int16 SAL_CALL ResultSet::getShort( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -785,10 +798,12 @@ sal_Int16 SAL_CALL ResultSet::getShort( sal_Int32 
columnIndex )
 // virtual
 sal_Int32 SAL_CALL ResultSet::getInt( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -807,10 +822,12 @@ sal_Int32 SAL_CALL ResultSet::getInt( sal_Int32 
columnIndex )
 // virtual
 sal_Int64 SAL_CALL ResultSet::getLong( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -829,10 +846,12 @@ sal_Int64 SAL_CALL ResultSet::getLong( sal_Int32 
columnIndex )
 // virtual
 float SAL_CALL ResultSet::getFloat( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -851,10 +870,12 @@ float SAL_CALL ResultSet::getFloat( sal_Int32 columnIndex 
)
 // virtual
 double SAL_CALL ResultSet::getDouble( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -874,10 +895,12 @@ double SAL_CALL ResultSet::getDouble( sal_Int32 
columnIndex )
 uno::Sequence< sal_Int8 > SAL_CALL
 ResultSet::getBytes( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -896,10 +919,12 @@ ResultSet::getBytes( sal_Int32 columnIndex )
 // virtual
 util::Date SAL_CALL ResultSet::getDate( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -918,10 +943,12 @@ util::Date SAL_CALL ResultSet::getDate( sal_Int32 
columnIndex )
 // virtual
 util::Time SAL_CALL ResultSet::getTime( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -941,10 +968,12 @@ util::Time SAL_CALL ResultSet::getTime( sal_Int32 
columnIndex )
 util::DateTime SAL_CALL
 ResultSet::getTimestamp( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -964,10 +993,12 @@ ResultSet::getTimestamp( sal_Int32 columnIndex )
 uno::Reference< io::XInputStream > SAL_CALL
 ResultSet::getBinaryStream( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -987,10 +1018,12 @@ ResultSet::getBinaryStream( sal_Int32 columnIndex )
 uno::Reference< io::XInputStream > SAL_CALL
 ResultSet::getCharacterStream( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -1011,10 +1044,12 @@ uno::Any SAL_CALL ResultSet::getObject(
         sal_Int32 columnIndex,
         const uno::Reference< container::XNameAccess >& typeMap )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -1034,10 +1069,12 @@ uno::Any SAL_CALL ResultSet::getObject(
 uno::Reference< sdbc::XRef > SAL_CALL
 ResultSet::getRef( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -1057,10 +1094,12 @@ ResultSet::getRef( sal_Int32 columnIndex )
 uno::Reference< sdbc::XBlob > SAL_CALL
 ResultSet::getBlob( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -1080,10 +1119,12 @@ ResultSet::getBlob( sal_Int32 columnIndex )
 uno::Reference< sdbc::XClob > SAL_CALL
 ResultSet::getClob( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -1103,10 +1144,12 @@ ResultSet::getClob( sal_Int32 columnIndex )
 uno::Reference< sdbc::XArray > SAL_CALL
 ResultSet::getArray( sal_Int32 columnIndex )
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
     {
         uno::Reference< sdbc::XRow > xValues
-            = m_pImpl->m_xDataSupplier->queryPropertyValues(
+            = m_pImpl->m_xDataSupplier->queryPropertyValues(aGuard,
                                                         m_pImpl->m_nPos - 1 );
         if ( xValues.is() )
         {
@@ -1139,8 +1182,10 @@ void SAL_CALL ResultSet::close()
 // virtual
 OUString SAL_CALL ResultSet::queryContentIdentifierString()
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
-        return m_pImpl->m_xDataSupplier->queryContentIdentifierString(
+        return m_pImpl->m_xDataSupplier->queryContentIdentifierString(aGuard,
                                                         m_pImpl->m_nPos - 1 );
 
     return OUString();
@@ -1151,8 +1196,10 @@ OUString SAL_CALL 
ResultSet::queryContentIdentifierString()
 uno::Reference< css::ucb::XContentIdentifier > SAL_CALL
 ResultSet::queryContentIdentifier()
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
-        return m_pImpl->m_xDataSupplier->queryContentIdentifier(
+        return m_pImpl->m_xDataSupplier->queryContentIdentifier(aGuard,
                                                         m_pImpl->m_nPos - 1 );
 
     return uno::Reference< css::ucb::XContentIdentifier >();
@@ -1163,8 +1210,10 @@ ResultSet::queryContentIdentifier()
 uno::Reference< css::ucb::XContent > SAL_CALL
 ResultSet::queryContent()
 {
+    std::unique_lock aGuard( m_pImpl->m_aMutex );
+
     if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
-        return m_pImpl->m_xDataSupplier->queryContent( m_pImpl->m_nPos - 1 );
+        return m_pImpl->m_xDataSupplier->queryContent( aGuard, m_pImpl->m_nPos 
- 1 );
 
     return uno::Reference< css::ucb::XContent >();
 }
@@ -1293,41 +1342,44 @@ void SAL_CALL ResultSet::removeVetoableChangeListener(
 
 // Non-interface methods.
 
-
 void ResultSet::propertyChanged( const beans::PropertyChangeEvent& rEvt ) const
 {
     std::unique_lock aGuard( m_pImpl->m_aMutex );
+    propertyChanged(aGuard, rEvt);
+}
 
+void ResultSet::propertyChanged( std::unique_lock<std::mutex>& rGuard, const 
beans::PropertyChangeEvent& rEvt ) const
+{
     if ( !m_pImpl->m_pPropertyChangeListeners )
         return;
 
     // Notify listeners interested especially in the changed property.
     comphelper::OInterfaceContainerHelper4<beans::XPropertyChangeListener>* 
pPropsContainer
-        = m_pImpl->m_pPropertyChangeListeners->getContainer(aGuard,
+        = m_pImpl->m_pPropertyChangeListeners->getContainer(rGuard,
                                                         rEvt.PropertyName );
     if ( pPropsContainer )
     {
-        pPropsContainer->notifyEach(aGuard, 
&beans::XPropertyChangeListener::propertyChange, rEvt);
+        pPropsContainer->notifyEach(rGuard, 
&beans::XPropertyChangeListener::propertyChange, rEvt);
     }
 
     // Notify listeners interested in all properties.
     pPropsContainer
-        = m_pImpl->m_pPropertyChangeListeners->getContainer( aGuard, 
OUString() );
+        = m_pImpl->m_pPropertyChangeListeners->getContainer( rGuard, 
OUString() );
     if ( pPropsContainer )
     {
-        pPropsContainer->notifyEach( aGuard, 
&beans::XPropertyChangeListener::propertyChange, rEvt);
+        pPropsContainer->notifyEach( rGuard, 
&beans::XPropertyChangeListener::propertyChange, rEvt);
     }
 }
 
 
-void ResultSet::rowCountChanged( sal_uInt32 nOld, sal_uInt32 nNew )
+void ResultSet::rowCountChanged( std::unique_lock<std::mutex>& rGuard, 
sal_uInt32 nOld, sal_uInt32 nNew )
 {
     OSL_ENSURE( nOld < nNew, "ResultSet::rowCountChanged - nOld >= nNew!" );
 
     if ( !m_pImpl->m_pPropertyChangeListeners )
         return;
 
-    propertyChanged(
+    propertyChanged( rGuard,
         beans::PropertyChangeEvent(
             getXWeak(),
             u"RowCount"_ustr,
@@ -1338,12 +1390,12 @@ void ResultSet::rowCountChanged( sal_uInt32 nOld, 
sal_uInt32 nNew )
 }
 
 
-void ResultSet::rowCountFinal()
+void ResultSet::rowCountFinal(std::unique_lock<std::mutex>& rGuard)
 {
     if ( !m_pImpl->m_pPropertyChangeListeners )
         return;
 
-    propertyChanged(
+    propertyChanged( rGuard,
         beans::PropertyChangeEvent(
             getXWeak(),
             u"IsRowCountFinal"_ustr,

Reply via email to