summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-01-09 00:10:02 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-01-10 19:38:51 +0000
commit33f97a124df7e10c6b9045e7fb12121bdd09db9e (patch)
treeb0d6d18007c5182ecb31d94bf72064d63411d9b3
parent6301820d72bca8ab065ed9c3c41ea4a3d04333e4 (diff)
librdf_Repository: fix missing mutex lock in various destructors
Change-Id: I5756ab6ff6de0b2532bef9866063f361e330a009 (cherry picked from commit 62fd1aa382c75feaa72f8aa09af4d3fc0b387dcc) Reviewed-on: https://gerrit.libreoffice.org/7338 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-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 a595af43bb08..b3c77e55ae56 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -413,7 +413,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()
@@ -520,7 +526,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()
@@ -795,6 +807,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();
@@ -803,7 +817,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();
}