[Libreoffice-commits] core.git: filter/source
Stephan Bergmann
sbergman at redhat.com
Mon Sep 11 16:10:20 UTC 2017
filter/source/xsltfilter/LibXSLTTransformer.cxx | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit b58777e6cd5ea1b3ef20ea81a6487635a1e19380
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Sep 11 18:08:29 2017 +0200
Fix further data race during CppunitTest_filter_xslt
> WARNING: ThreadSanitizer: data race (pid=25817)
> Write of size 8 at 0x7b50000108a8 by thread T2:
> #0 memset compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:710 (cppunittester+0x46672b)
> #1 xsltFreeTransformContext workdir/UnpackedTarball/xslt/libxslt/transform.c:760:5 (libxslt.so.1+0x383a2)
> #2 XSLT::Reader::execute() filter/source/xsltfilter/LibXSLTTransformer.cxx:338:9 (libxsltfilterlo.so+0x10aa9)
> #3 salhelper::Thread::run() salhelper/source/thread.cxx:40:9 (libuno_salhelpergcc3.so.3+0x5f6c)
> #4 non-virtual thunk to salhelper::Thread::run() salhelper/source/thread.cxx (libuno_salhelpergcc3.so.3+0x603c)
> #5 threadFunc include/osl/thread.hxx:185:15 (libuno_salhelpergcc3.so.3+0x6fac)
> #6 osl_thread_start_Impl(void*) sal/osl/unx/thread.cxx:237:9 (libuno_sal.so.3+0xeb6b5)
>
> Previous write of size 4 at 0x7b50000108a8 by main thread (mutexes: write M713392882458407696):
> #0 XSLT::Reader::forceStateStopped() filter/source/xsltfilter/LibXSLTTransformer.cxx:375:25 (libxsltfilterlo.so+0x1100e)
> #1 XSLT::LibXSLTTransformer::~LibXSLTTransformer() filter/source/xsltfilter/LibXSLTTransformer.hxx:127:27 (libxsltfilterlo.so+0x18346)
> #2 XSLT::LibXSLTTransformer::~LibXSLTTransformer() filter/source/xsltfilter/LibXSLTTransformer.hxx:124:48 (libxsltfilterlo.so+0x1850c)
> #3 cppu::OWeakObject::release() cppuhelper/source/weak.cxx:232:9 (libuno_cppuhelpergcc3.so.3+0x20a527)
> #4 cppu::WeakImplHelper<com::sun::star::xml::xslt::XXSLTTransformer>::release() include/cppuhelper/implbase.hxx:112:62 (libxsltfilterlo.so+0x18168)
> #5 non-virtual thunk to cppu::WeakImplHelper<com::sun::star::xml::xslt::XXSLTTransformer>::release() include/cppuhelper/implbase.hxx (libxsltfilterlo.so+0x188fc)
> #6 com::sun::star::uno::Reference<com::sun::star::xml::xslt::XXSLTTransformer>::~Reference() include/com/sun/star/uno/Reference.hxx:110:22 (libtest_filter_xslt.so+0x14c44)
> #7 (anonymous namespace)::XsltFilterTest::testXsltCopyOld() filter/qa/cppunit/xslt-test.cxx:201:1 (libtest_filter_xslt.so+0x94c6)
> #8 void std::__invoke_impl<void, void ((anonymous namespace)::XsltFilterTest::* const&)(), (anonymous namespace)::XsltFilterTest*&>(std::__invoke_memfun_deref, void ((anonymous namespace)::XsltFilterTest::* const&)(), (anonymous namespace)::XsltFilterTest*&) /usr/lib/gcc/x86_64-redhat-linux/6.4.1/../../../../include/c++/6.4.1/functional:227:14 (libtest_filter_xslt.so+0xeeae)
> #9 std::result_of<void ((anonymous namespace)::XsltFilterTest::* const&((anonymous namespace)::XsltFilterTest*&))()>::type std::__invoke<void ((anonymous namespace)::XsltFilterTest::* const&)(), (anonymous namespace)::XsltFilterTest*&>(void ((anonymous namespace)::XsltFilterTest::* const&)(), (anonymous namespace)::XsltFilterTest*&) /usr/lib/gcc/x86_64-redhat-linux/6.4.1/../../../../include/c++/6.4.1/functional:250:14 (libtest_filter_xslt.so+0xed9d)
> #10 _ZNKSt12_Mem_fn_baseIMN12_GLOBAL__N_114XsltFilterTestEFvvELb1EEclIJRPS1_EEEDTclsr3stdE8__invokedtdefpT6_M_pmfspclsr3stdE7forwardIT_Efp_EEEDpOS8_ /usr/lib/gcc/x86_64-redhat-linux/6.4.1/../../../../include/c++/6.4.1/functional:604:11 (libtest_filter_xslt.so+0xec7b)
> #11 void std::_Bind<std::_Mem_fn<void ((anonymous namespace)::XsltFilterTest::*)()> ((anonymous namespace)::XsltFilterTest*)>::__call<void, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/lib/gcc/x86_64-redhat-linux/6.4.1/../../../../include/c++/6.4.1/functional:933:11 (libtest_filter_xslt.so+0xebeb)
> #12 void std::_Bind<std::_Mem_fn<void ((anonymous namespace)::XsltFilterTest::*)()> ((anonymous namespace)::XsltFilterTest*)>::operator()<, void>() /usr/lib/gcc/x86_64-redhat-linux/6.4.1/../../../../include/c++/6.4.1/functional:991:17 (libtest_filter_xslt.so+0xeaf6)
> #13 std::_Function_handler<void (), std::_Bind<std::_Mem_fn<void ((anonymous namespace)::XsltFilterTest::*)()> ((anonymous namespace)::XsltFilterTest*)> >::_M_invoke(std::_Any_data const&) /usr/lib/gcc/x86_64-redhat-linux/6.4.1/../../../../include/c++/6.4.1/functional:1731:2 (libtest_filter_xslt.so+0xe4ba)
> #14 std::function<void ()>::operator()() const /usr/lib/gcc/x86_64-redhat-linux/6.4.1/../../../../include/c++/6.4.1/functional:2127:14 (libtest_filter_xslt.so+0x1fb3e)
> #15 CppUnit::TestCaller<(anonymous namespace)::XsltFilterTest>::runTest() workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:175:7 (libtest_filter_xslt.so+0xdc5c)
> #16 CppUnit::TestCaseMethodFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5 (libcppunit-1.14.so.0+0xd61d2)
> #17 (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) test/source/vclbootstrapprotector.cxx:39:14 (libvclbootstrapprotector.so+0x1114)
> #18 CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 (libcppunit-1.14.so.0+0xc7614)
> #19 (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:89:12 (unobootstrapprotector.so+0x2204)
> #20 CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 (libcppunit-1.14.so.0+0xc7614)
> #21 (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:63:16 (unoexceptionprotector.so+0x23e9)
> #22 CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 (libcppunit-1.14.so.0+0xc7614)
> #23 CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12 (libcppunit-1.14.so.0+0xa57ad)
> #24 CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 (libcppunit-1.14.so.0+0xc7614)
> #25 CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:86:18 (libcppunit-1.14.so.0+0xc4a96)
> #26 CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:182:28 (libcppunit-1.14.so.0+0xf4714)
> #27 CppUnit::TestCase::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:13 (libcppunit-1.14.so.0+0xd5750)
> #28 CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30 (libcppunit-1.14.so.0+0xd6d5a)
> #29 CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3 (libcppunit-1.14.so.0+0xd6a2e)
> #30 CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30 (libcppunit-1.14.so.0+0xd6d5a)
> #31 CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3 (libcppunit-1.14.so.0+0xd6a2e)
> #32 CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:27 (libcppunit-1.14.so.0+0x10282c)
> #33 CppUnit::TestResult::runTest(CppUnit::Test*) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:149:9 (libcppunit-1.14.so.0+0xf4223)
> #34 CppUnit::TestRunner::run(CppUnit::TestResult&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:96:14 (libcppunit-1.14.so.0+0x102c76)
> #35 (anonymous namespace)::ProtectedFixtureFunctor::run() const sal/cppunittester/cppunittester.cxx:316:20 (cppunittester+0x4bd658)
> #36 sal_main() sal/cppunittester/cppunittester.cxx:466:20 (cppunittester+0x4bc28e)
> #37 main sal/cppunittester/cppunittester.cxx:373:1 (cppunittester+0x4bbb05)
Change-Id: I2bee009247fe00d5b3386327164766822bfa4bf3
diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx
index 35d3dfcc8242..869643003edb 100644
--- a/filter/source/xsltfilter/LibXSLTTransformer.cxx
+++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx
@@ -13,6 +13,7 @@
#include <cstring>
#include <list>
#include <map>
+#include <utility>
#include <vector>
#include <iostream>
#include <libxml/parser.h>
@@ -335,11 +336,12 @@ namespace XSLT
closeOutput();
oh.reset();
xsltFreeStylesheet(styleSheet);
- xsltFreeTransformContext(m_tcontext);
+ xsltTransformContextPtr tcontext = nullptr;
{
std::unique_lock<std::mutex> g(m_mutex);
- m_tcontext = nullptr;
+ std::swap(m_tcontext, tcontext);
}
+ xsltFreeTransformContext(tcontext);
xmlFreeDoc(doc);
xmlFreeDoc(result);
}
More information about the Libreoffice-commits
mailing list