From e1f8907816cfc105a23766bf7daa101a2f38a367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Sat, 15 Jan 2011 19:52:55 +0000 Subject: [PATCH] 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 --- src/support/unicode.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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;