summaryrefslogtreecommitdiff
path: root/unoxml/source
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-01-09 00:10:02 +0100
committerMichael Stahl <mstahl@redhat.com>2014-01-09 12:08:21 +0100
commit62fd1aa382c75feaa72f8aa09af4d3fc0b387dcc (patch)
treef1ed460dcb44978d20ce59020fb5018d1d5c940e /unoxml/source
parent7db6b2f7968d8063b12312737136f09cb7549805 (diff)
librdf_Repository: fix missing mutex lock in various destructors
Change-Id: I5756ab6ff6de0b2532bef9866063f361e330a009
Diffstat (limited to 'unoxml/source')
-rw-r--r--unoxml/source/rdf/librdf_repository.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx
index 52f3b96e6eaf..6d7df634e0b7 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -475,7 +475,13 @@ public:
, m_pStream(i_pStream)
{ };
- virtual ~librdf_GraphResult() {}
+ virtual ~librdf_GraphResult()
+ {
+ ::osl::MutexGuard g(m_rMutex); // lock mutex when destroying members
+ const_cast<boost::shared_ptr<librdf_stream>& >(m_pStream).reset();
+ const_cast<boost::shared_ptr<librdf_node>& >(m_pContext).reset();
+ const_cast<boost::shared_ptr<librdf_query>& >(m_pQuery).reset();
+ }
// ::com::sun::star::container::XEnumeration:
virtual ::sal_Bool SAL_CALL hasMoreElements()
@@ -582,7 +588,13 @@ public:
, m_BindingNames(i_rBindingNames)
{ };
- virtual ~librdf_QuerySelectResult() {}
+ virtual ~librdf_QuerySelectResult()
+ {
+ ::osl::MutexGuard g(m_rMutex); // lock mutex when destroying members
+ const_cast<boost::shared_ptr<librdf_query_results>& >(m_pQueryResult)
+ .reset();
+ const_cast<boost::shared_ptr<librdf_query>& >(m_pQuery).reset();
+ }
// ::com::sun::star::container::XEnumeration:
virtual ::sal_Bool SAL_CALL hasMoreElements()
@@ -862,6 +874,8 @@ librdf_Repository::librdf_Repository(
librdf_Repository::~librdf_Repository()
{
+ ::osl::MutexGuard g(m_aMutex);
+
// must destroy these before world!
m_pModel.reset();
m_pStorage.reset();
@@ -870,7 +884,6 @@ librdf_Repository::~librdf_Repository()
// (via raptor_sax2_finish) call xmlCleanupParser, which will
// free libxml2's globals! ARRRGH!!! => never call librdf_free_world
#if 0
- ::osl::MutexGuard g(m_aMutex);
if (!--m_NumInstances) {
m_pWorld.reset();
}