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
This commit is contained in:
Peter Kümmel 2011-01-15 19:52:55 +00:00
parent fa632bfd7e
commit e1f8907816

View File

@ -25,6 +25,8 @@
#include <ostream>
#include <string>
#include <QMutexLocker>
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;