diff options
author | Oliver Specht <oliver.specht@cib.de> | 2016-02-02 12:59:17 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-06-16 09:01:50 +0000 |
commit | 00a988896755dd9066d62892d38da0efe769493c (patch) | |
tree | 7b48c662354d9c7e804bfed071bcb66aa8204d95 | |
parent | 53b97fd4d058ac36b20555b843a8194b6128e4e3 (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>
(cherry picked from commit 4426c20cf308f3bf7a2d3b33f9996687113c22e3)
Reviewed-on: https://gerrit.libreoffice.org/26304
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index df149305d9f4..bfe28a3b1840 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -788,20 +788,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 } } } |