mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
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:
parent
fa632bfd7e
commit
e1f8907816
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user