summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2016-02-02 12:59:17 +0100
committerOliver Specht <oliver.specht@cib.de>2016-02-03 07:04:30 +0000
commit4426c20cf308f3bf7a2d3b33f9996687113c22e3 (patch)
tree45fe11e15a1ed412442870c274df6bec5e47cd13
parent3d3204be2c1c8c3aded94cdf3d2ead7958c8b2f1 (diff)
tdf#97501: crash in SwDBManager fixed
copy the connections to a temp container and iterate that because disposing connections changes the data source params container Change-Id: I06c59a19a6bcf97a541b32481d1d2a63f5c34032 Reviewed-on: https://gerrit.libreoffice.org/22027 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Oliver Specht <oliver.specht@cib.de>
-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
}
}
}