summaryrefslogtreecommitdiffstats
path: root/src/corelib/codecs
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-08-15 18:10:02 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-12 12:55:13 +0200
commite8e2e26d5aa97b56519f5c7bea706aff0fd86326 (patch)
tree73af1370c36b942dd5596a9d031a9766065a1ab8 /src/corelib/codecs
parent687461627310e8b781da15d1a907c35bd8ffea6e (diff)
don't crash when destroying codec list
this was uncovered by rittk's don't-detach patch. (cherry picked from commit cc98710df73a590c37dca19bd3aa9fcd9bbd5a92) Change-Id: I2225e6a94e5562459d9c5fd27ac7c8e611b674fd Reviewed-on: http://codereview.qt-project.org/4580 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'src/corelib/codecs')
-rw-r--r--src/corelib/codecs/qtextcodec.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 944be3620f..f28133be77 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -213,12 +213,13 @@ QTextCodecCleanup::~QTextCodecCleanup()
destroying_is_ok = true;
#endif
- for (QList<QTextCodec *>::const_iterator it = all->constBegin()
- ; it != all->constEnd(); ++it) {
+ QList<QTextCodec *> *myAll = all;
+ all = 0; // Otherwise the d'tor destroys the iterator
+ for (QList<QTextCodec *>::const_iterator it = myAll->constBegin()
+ ; it != myAll->constEnd(); ++it) {
delete *it;
}
- delete all;
- all = 0;
+ delete myAll;
localeMapper = 0;
#ifdef Q_DEBUG_TEXTCODEC