From: Peter Kümmel Date: Sat, 15 Jan 2011 19:52:55 +0000 (+0000) Subject: fix #7240 Random crashes: iconv() is not thread save X-Git-Tag: 2.0.0~1095 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=e1f8907816cfc105a23766bf7daa101a2f38a367;p=features.git fix #7240 Random crashes: iconv() is not thread save git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37217 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/support/unicode.cpp b/src/support/unicode.cpp index 26c6a239d7..0e773f5327 100644 --- a/src/support/unicode.cpp +++ b/src/support/unicode.cpp @@ -25,6 +25,8 @@ #include #include +#include + using namespace std; namespace { @@ -64,6 +66,8 @@ struct IconvProcessor::Impl iconv_t cd; string tocode_; string fromcode_; + + QMutex mutex_; // iconv() is not thread save }; @@ -120,6 +124,8 @@ bool IconvProcessor::init() int IconvProcessor::convert(char const * buf, size_t buflen, char * outbuf, size_t maxoutsize) { + QMutexLocker lock(&pimpl_->mutex_); + if (buflen == 0) return 0;