diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-08-15 16:10:02 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-08-15 17:00:01 (GMT) |
commit | cc98710df73a590c37dca19bd3aa9fcd9bbd5a92 (patch) | |
tree | 67a834b9bcacc69818ac9310773b521e01fa1b8f | |
parent | 8d3d3381c127f0f4dd9fc507c3069acddbf40535 (diff) | |
download | Qt-cc98710df73a590c37dca19bd3aa9fcd9bbd5a92.zip Qt-cc98710df73a590c37dca19bd3aa9fcd9bbd5a92.tar.gz Qt-cc98710df73a590c37dca19bd3aa9fcd9bbd5a92.tar.bz2 |
don't crash when destroying codec list
this was uncovered by rittk's don't-detach patch.
-rw-r--r-- | src/corelib/codecs/qtextcodec.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 0a37f27..263b5f9 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 |