sax/source/fastparser/fastparser.cxx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
New commits: commit 5f3a3de26fca5e3e37e4a08940fa4bf9da5e5ecc Author: Michael Meeks <[email protected]> AuthorDate: Fri Sep 14 11:53:39 2018 +0100 Commit: Andras Timar <[email protected]> CommitDate: Mon Sep 17 13:47:54 2018 +0200 Join the thread only if launch succeeded. Change-Id: Idee779cea587e11f6d0f7902182c9394e73d46eb Reviewed-on: https://gerrit.libreoffice.org/60488 Tested-by: Jenkins Reviewed-by: Michael Meeks <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/60544 Reviewed-by: Andras Timar <[email protected]> Tested-by: Andras Timar <[email protected]> diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 1c3ee79607af..9959489eed3f 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -825,8 +825,8 @@ void FastSaxParserImpl::parseStream(const InputSource& maStructSource) { rtl::Reference<ParserThread> xParser; xParser = new ParserThread(this); - aEnsureFree.setThread(xParser); xParser->launch(); + aEnsureFree.setThread(xParser); bool done = false; do { rEntity.maConsumeResume.wait(); commit d06a8ce1434c1dcb45770e08395443771f57f1e9 Author: Michael Meeks <[email protected]> AuthorDate: Tue Sep 11 22:28:08 2018 +0100 Commit: Andras Timar <[email protected]> CommitDate: Mon Sep 17 13:47:43 2018 +0200 Ensure fastparser thread is joined in case of exceptions. Change-Id: Ie0fb21776514a9a67e9fdff2ae856392cd711adb Reviewed-on: https://gerrit.libreoffice.org/60542 Reviewed-by: Andras Timar <[email protected]> Tested-by: Andras Timar <[email protected]> diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index a0b568c46e38..1c3ee79607af 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -754,6 +754,7 @@ namespace private: FastSaxParserImpl& m_rParser; Entity& m_rEntity; + rtl::Reference<ParserThread> m_xParser; public: ParserCleanup(FastSaxParserImpl& rParser, Entity& rEntity) : m_rParser(rParser) @@ -765,6 +766,20 @@ namespace //xmlFreeParserCtxt accepts a null arg xmlFreeParserCtxt(m_rEntity.mpParser); m_rParser.popEntity(); + joinThread(); + } + void setThread(const rtl::Reference<ParserThread> &xParser) + { + m_xParser = xParser; + } + void joinThread() + { + if (m_xParser.is()) + { + rtl::Reference<ParserThread> xToJoin = m_xParser; + m_xParser.clear(); + xToJoin->join(); + } } }; } @@ -810,6 +825,7 @@ void FastSaxParserImpl::parseStream(const InputSource& maStructSource) { rtl::Reference<ParserThread> xParser; xParser = new ParserThread(this); + aEnsureFree.setThread(xParser); xParser->launch(); bool done = false; do { @@ -851,7 +867,7 @@ void FastSaxParserImpl::parseStream(const InputSource& maStructSource) rEntity.maUsedEvents.push(std::move(xEventList)); } } while (!done); - xParser->join(); + aEnsureFree.joinThread(); deleteUsedEvents(); // callbacks used inside XML_Parse may have caught an exception _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
