diff options
Diffstat (limited to 'src/codecs/qtextcodec.cpp')
-rw-r--r-- | src/codecs/qtextcodec.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/codecs/qtextcodec.cpp b/src/codecs/qtextcodec.cpp index 1c6df6953..2e26320ae 100644 --- a/src/codecs/qtextcodec.cpp +++ b/src/codecs/qtextcodec.cpp @@ -90,12 +90,14 @@ static TQValueList<TQTextCodec*> *all = 0; static bool destroying_is_ok; // starts out as 0 +static bool codecs_were_cleansed = 0; static TQTextCodec * localeMapper = 0; class TQTextCodecCleanup { public: ~TQTextCodecCleanup() { TQTextCodec::deleteAllCodecs(); + codecs_were_cleansed = TRUE; } }; static TQTextCodecCleanup qtextcodec_cleanup; @@ -140,6 +142,8 @@ void TQTextCodec::deleteAllCodecs() ball->clear(); delete ball; + localeMapper = 0; + destroying_is_ok = FALSE; } @@ -821,7 +825,12 @@ TQTextCodec* TQTextCodec::codecForLocale() if ( localeMapper ) return localeMapper; - setup(); + // codecForLocale() is used by TQString::locale8Bit(), which is used by tqWarning() (and such) + // which should be fine to call during final cleanup and in such case we don't want neither to + // recreate the codecs again nor complains about codecs being already destroyed. + if ( !codecs_were_cleansed ) { + setup(); + } return localeMapper; } @@ -2906,6 +2915,8 @@ static void realSetup() #if defined(QT_CHECK_STATE) if ( destroying_is_ok ) tqWarning( "TQTextCodec: creating new codec during codec cleanup!" ); + if ( codecs_were_cleansed ) + tqWarning( "TQTextCodec: trying to setup codecs after they already been cleansed!" ); #endif all = new TQValueList<TQTextCodec*>; |