Load default codecs even if custom QTextCodec has been registered

Task-number: QTBUG-40378
Change-Id: I33f1e92127972e1346993aa4e07731bf4b697667
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Kai Koehne 2014-10-20 16:16:54 +02:00
parent c9b49612ff
commit 51ec20d93e

View File

@ -253,9 +253,10 @@ static QTextCodec *setupLocaleMapper()
// textCodecsMutex need to be locked to enter this function
static void setup()
{
QCoreGlobalData *globalData = QCoreGlobalData::instance();
if (!globalData->allCodecs.isEmpty())
static bool initialized = false;
if (initialized)
return;
initialized = true;
#if !defined(QT_NO_CODECS) && !defined(QT_BOOTSTRAPPED)
(void)new QTsciiCodec;
@ -465,7 +466,11 @@ QTextCodec::QTextCodec()
{
QMutexLocker locker(textCodecsMutex());
QCoreGlobalData::instance()->allCodecs.prepend(this);
QCoreGlobalData *globalInstance = QCoreGlobalData::instance();
if (globalInstance->allCodecs.isEmpty())
setup();
globalInstance->allCodecs.prepend(this);
}