diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2014-10-20 16:16:54 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2014-10-30 10:52:11 +0100 |
commit | 51ec20d93e97c777fc89e96d8d035d999c8a4ad9 (patch) | |
tree | 901d0b3d56029d5344b39ada0c563d234ac796d2 /src/corelib/codecs/qtextcodec.cpp | |
parent | c9b49612fff597498a03a5d8161765f03bc54e53 (diff) |
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>
Diffstat (limited to 'src/corelib/codecs/qtextcodec.cpp')
-rw-r--r-- | src/corelib/codecs/qtextcodec.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index bceead72f3..d2857c03b6 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -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); } |