From fde8259dd8844410f878fe97db38979cc4c6f56a Mon Sep 17 00:00:00 2001 From: Murray Read Date: Thu, 15 Mar 2012 15:41:25 +0000 Subject: Crash in Symbian text codec creation without CleanupStack The Symbian text codec is creating a CCnvCharacterSetConverter with its NewL() function. This requires the CleanupStack, otherwise you get a E32USER-CBase 69 panic. But sometimes apps have been using text streams and other objects in static data construction or destruction which use the text codec where there is no CleanupStack. This change detects is a CleanupStack is present and temporarily creates one if not. Change-Id: Ia68fa60b4f0e3d675ee302208a625c6e9493a6f1 Reviewed-by: Shane Kearns --- src/corelib/codecs/qtextcodec_symbian.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/corelib/codecs/qtextcodec_symbian.cpp b/src/corelib/codecs/qtextcodec_symbian.cpp index 1b09ec4..e1eb336 100644 --- a/src/corelib/codecs/qtextcodec_symbian.cpp +++ b/src/corelib/codecs/qtextcodec_symbian.cpp @@ -167,8 +167,12 @@ Q_GLOBAL_STATIC(QThreadStorage,gs_converterStore); CCnvCharacterSetConverter *QSymbianTextCodec::converter() { CCnvCharacterSetConverter *&conv = gs_converterStore()->localData(); - if (!conv) + if (!conv) { + QScopedPointer trap; + if (!User::TrapHandler()) + trap.reset(CTrapCleanup::New()); QT_TRAP_THROWING(conv = CCnvCharacterSetConverter::NewL()) + } return conv; } -- cgit v0.12