summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-12-13 11:52:39 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-12-30 17:22:39 +0100
commit07a2d583ae5d7b6f983c4401eef92a052b15af02 (patch)
tree42966b85c45db11fad96bafde46a38e99654c8a4 /i18npool
parent9f8dd17b1e6ab5d5d07b61e0f85edea233f03d71 (diff)
crash in sc, make TextSearch thread safe
with tdf95460-1.odt Change-Id: Ic4e643b8e6ae6235fb79ed458f891afd4a4b73fc Reviewed-on: https://gerrit.libreoffice.org/46380 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/search/textsearch.cxx8
-rw-r--r--i18npool/source/search/textsearch.hxx1
2 files changed, 9 insertions, 0 deletions
diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx
index 67eded1643ab..6f51d3b2cbf0 100644
--- a/i18npool/source/search/textsearch.cxx
+++ b/i18npool/source/search/textsearch.cxx
@@ -133,6 +133,8 @@ TextSearch::~TextSearch()
void TextSearch::setOptions2( const SearchOptions2& rOptions )
{
+ osl::MutexGuard g(m_aMutex);
+
aSrchPara = rOptions;
delete pRegexMatcher;
@@ -263,6 +265,8 @@ void TextSearch::setOptions2( const SearchOptions2& rOptions )
void TextSearch::setOptions( const SearchOptions& rOptions )
{
+ osl::MutexGuard g(m_aMutex);
+
sal_Int16 nAlgorithmType2;
switch (rOptions.algorithmType)
{
@@ -313,6 +317,8 @@ bool TextSearch::isCellStart(const OUString& searchStr, sal_Int32 nPos)
SearchResult TextSearch::searchForward( const OUString& searchStr, sal_Int32 startPos, sal_Int32 endPos )
{
+ osl::MutexGuard g(m_aMutex);
+
SearchResult sres;
OUString in_str(searchStr);
@@ -428,6 +434,8 @@ SearchResult TextSearch::searchForward( const OUString& searchStr, sal_Int32 sta
SearchResult TextSearch::searchBackward( const OUString& searchStr, sal_Int32 startPos, sal_Int32 endPos )
{
+ osl::MutexGuard g(m_aMutex);
+
SearchResult sres;
OUString in_str(searchStr);
diff --git a/i18npool/source/search/textsearch.hxx b/i18npool/source/search/textsearch.hxx
index 6f9c3d189cf4..05c158d302a1 100644
--- a/i18npool/source/search/textsearch.hxx
+++ b/i18npool/source/search/textsearch.hxx
@@ -43,6 +43,7 @@ class TextSearch: public cppu::WeakImplHelper
css::lang::XServiceInfo
>
{
+ osl::Mutex m_aMutex;
css::uno::Reference < css::uno::XComponentContext > m_xContext;
css::util::SearchOptions2 aSrchPara;