X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Funicode.cpp;h=b48f10609f7fe9315e257575aec432b9d8fcb1dc;hb=f3ff5e083a6e89861db5fce9eea4532504f8341d;hp=26c6a239d759d5a355712ccccadb6afa0839092c;hpb=9b9a3cf0c001d25c07056f37b3ccfd8025eefbcf;p=lyx.git diff --git a/src/support/unicode.cpp b/src/support/unicode.cpp index 26c6a239d7..b48f10609f 100644 --- a/src/support/unicode.cpp +++ b/src/support/unicode.cpp @@ -14,6 +14,7 @@ #include "support/unicode.h" #include "support/debug.h" +#include "support/mutex.h" #include @@ -25,6 +26,7 @@ #include #include + using namespace std; namespace { @@ -64,6 +66,8 @@ struct IconvProcessor::Impl iconv_t cd; string tocode_; string fromcode_; + + Mutex mutex_; // iconv() is not thread save, see #7240 }; @@ -120,6 +124,8 @@ bool IconvProcessor::init() int IconvProcessor::convert(char const * buf, size_t buflen, char * outbuf, size_t maxoutsize) { + Mutex::Locker lock(&pimpl_->mutex_); + if (buflen == 0) return 0;