diff options
author | Shane Kearns <shane.kearns@sosco.com> | 2009-11-03 12:03:11 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@sosco.com> | 2009-11-03 12:55:19 (GMT) |
commit | 3769f290ccc20ff92dd43038743f96097d9fabd0 (patch) | |
tree | eaa0c7b9f8ad4ec18a7bec2efab170330cc4d51d /src/s60main | |
parent | 5308b1c607c1209822078d8aae329308c8017636 (diff) | |
download | Qt-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/s60main')
-rw-r--r-- | src/s60main/qts60main_mcrt0.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp index d30e07a..edc2fb8 100644 --- a/src/s60main/qts60main_mcrt0.cpp +++ b/src/s60main/qts60main_mcrt0.cpp @@ -83,12 +83,10 @@ GLDEF_C TInt QtMainWrapper() char **envp = 0; // get args & environment __crt0(argc, argv, envp); - CleanupArrayDelete<char*>::PushL(argv); - CleanupArrayDelete<char*>::PushL(envp); //Call user(application)'s main - int ret = 0; - QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp);); - CleanupStack::PopAndDestroy(2, argv); + TRAPD(ret, QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp);)); + delete[] argv; + delete[] envp; return ret; } |