From c4963268ba73d8ffd1d5089ad07cd816f486cec6 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 12 Aug 2019 12:04:58 +0200 Subject: [PATCH] Fix regexTools. The buildMatcher must not take a rvalue as it will keep a reference to it. --- src/tools/regexTools.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tools/regexTools.cpp b/src/tools/regexTools.cpp index 3f1d5b8ab..914404085 100644 --- a/src/tools/regexTools.cpp +++ b/src/tools/regexTools.cpp @@ -30,7 +30,7 @@ std::map> regexCache; static pthread_mutex_t regexLock = PTHREAD_MUTEX_INITIALIZER; -std::unique_ptr buildMatcher(const std::string& regex, const icu::UnicodeString& content) +std::unique_ptr buildMatcher(const std::string& regex, icu::UnicodeString& content) { std::shared_ptr pattern; /* Regex is in cache */ @@ -56,7 +56,8 @@ std::unique_ptr buildMatcher(const std::string& regex, const bool matchRegex(const std::string& content, const std::string& regex) { ucnv_setDefaultName("UTF-8"); - auto matcher = buildMatcher(regex, content.c_str()); + icu::UnicodeString ucontent(content.c_str()); + auto matcher = buildMatcher(regex, ucontent); return matcher->find(); }