diff options
Diffstat (limited to 'src/corelib/codecs/qtextcodec.cpp')
-rw-r--r-- | src/corelib/codecs/qtextcodec.cpp | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 790921610a..fedd39e104 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2018 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -494,6 +495,24 @@ QTextCodec::QTextCodec() */ QTextCodec::~QTextCodec() { + QCoreGlobalData *globalData = QCoreGlobalData::instance(); + if (!globalData) + return; + + globalData->codecForLocale.testAndSetRelaxed(this, nullptr); + + QMutexLocker locker(textCodecsMutex()); + + globalData->allCodecs.removeOne(this); + + auto it = globalData->codecCache.cbegin(); + + while (it != globalData->codecCache.cend()) { + if (it.value() == this) + it = globalData->codecCache.erase(it); + else + ++it; + } } /*! @@ -1220,6 +1239,19 @@ bool QTextDecoder::hasFailure() const return state.invalidChars != 0; } +/*! + \internal + \since 5.12 + + Determines whether the decoder needs more bytes to continue decoding. That + is, this signifies that the input string ended in the middle of a + multi-byte sequence. Note that it's possible some codecs do not report this. + */ +bool QTextDecoder::needsMoreData() const +{ + return state.remainingChars; +} + QT_END_NAMESPACE #endif // QT_NO_TEXTCODEC |