unoxml/source/rdf/librdf_repository.cxx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
New commits: commit 33f97a124df7e10c6b9045e7fb12121bdd09db9e Author: Michael Stahl <mst...@redhat.com> Date: Thu Jan 9 00:10:02 2014 +0100 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 <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index a595af4..b3c77e5 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(); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits