summaryrefslogtreecommitdiff
path: root/sw/source/uibase/dbui/dbmgr.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/dbui/dbmgr.cxx')
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx26
1 files changed, 16 insertions, 10 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 864e45b934ac..0aea9c99a21d 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -771,20 +771,26 @@ SwDBManager::SwDBManager(SwDoc* pDoc)
SwDBManager::~SwDBManager()
{
+ // copy required, m_DataSourceParams can be modifed while disposing components
+ std::vector<uno::Reference<sdbc::XConnection>> aCopiedConnections;
for (auto & pParam : m_DataSourceParams)
{
if(pParam->xConnection.is())
{
- try
- {
- uno::Reference<lang::XComponent> xComp(pParam->xConnection, uno::UNO_QUERY);
- if(xComp.is())
- xComp->dispose();
- }
- catch(const uno::RuntimeException&)
- {
- //may be disposed already since multiple entries may have used the same connection
- }
+ aCopiedConnections.push_back(pParam->xConnection);
+ }
+ }
+ for (auto & xConnection : aCopiedConnections)
+ {
+ try
+ {
+ uno::Reference<lang::XComponent> xComp(xConnection, uno::UNO_QUERY);
+ if(xComp.is())
+ xComp->dispose();
+ }
+ catch(const uno::RuntimeException&)
+ {
+ //may be disposed already since multiple entries may have used the same connection
}
}
}