summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication_s60.cpp
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@sosco.com>2009-11-03 12:03:11 (GMT)
committerShane Kearns <shane.kearns@sosco.com>2009-11-03 12:55:19 (GMT)
commit3769f290ccc20ff92dd43038743f96097d9fabd0 (patch)
treeeaa0c7b9f8ad4ec18a7bec2efab170330cc4d51d /src/gui/kernel/qapplication_s60.cpp
parent5308b1c607c1209822078d8aae329308c8017636 (diff)
downloadQt-3769f290ccc20ff92dd43038743f96097d9fabd0.zip
Qt-3769f290ccc20ff92dd43038743f96097d9fabd0.tar.gz
Qt-3769f290ccc20ff92dd43038743f96097d9fabd0.tar.bz2
Fix cleanupstack crash on exit in Symbian OS 9.2
Destroying the control environment also pops items from the original cleanup stack which is not owned by the control environment. This is a platform issue (and does not occur in 9.3 & 9.4). To avoid this causing a panic, the s60main is changed to not push items on the cleanup stack (instead, it TRAPs the call to main(), and deletes its allocations manually). A further 9.2 cleanup stack crash was caused when application construction fails (because of missing resource files). The resulting exception would bypass deleting the control environment, and return from main with the wrong cleanup stack active. This is resolved by doing the TRAP / cleanup / throw manually instead of using qt_trap_throwing (The control environment cannot be pushed to the cleanup stack, because it owns the cleanup stack at that time). This isn't a 9.2 specific bug, but rather is revealed by 9.2 because the missing resource file is non fatal in 9.3 and 9.4. Fixes many autotests which have crashed on S60 3.1 since the cleanup stack swapping patch. Reviewed-by: axis
Diffstat (limited to 'src/gui/kernel/qapplication_s60.cpp')
-rw-r--r--src/gui/kernel/qapplication_s60.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index e5ee2f1..1b0659a 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1052,8 +1052,17 @@ void qt_init(QApplicationPrivate * /* priv */, int)
// After this construction, CEikonEnv will be available from CEikonEnv::Static().
// (much like our qApp).
CEikonEnv* coe = new CEikonEnv;
- QT_TRAP_THROWING(coe->ConstructAppFromCommandLineL(factory,*commandLine));
+ //not using QT_TRAP_THROWING, because coe owns the cleanupstack so it can't be pushed there.
+ if(err == KErrNone)
+ TRAP(err, coe->ConstructAppFromCommandLineL(factory,*commandLine));
delete commandLine;
+ if(err != KErrNone) {
+ qWarning() << "qt_init: Eikon application construct failed ("
+ << err
+ << "), maybe missing resource file on S60 3.1?";
+ delete coe;
+ qt_symbian_throwIfError(err);
+ }
S60->s60InstalledTrapHandler = User::SetTrapHandler(origTrapHandler);