diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-01 23:44:02 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-01 23:44:02 (GMT) |
commit | efa4b886b173cb730e537cbc5afd3ac01ca8c78c (patch) | |
tree | 4add216647162fc2da11c49c642ed1265e749261 /src/s60main/qts60main_mcrt0.cpp | |
parent | fa5e912c80bc62c5bf53d3ddecc605a74b8c8e27 (diff) | |
parent | 6b3cd57ffd2646aa41f1509e64f949fc390a961f (diff) | |
download | Qt-efa4b886b173cb730e537cbc5afd3ac01ca8c78c.zip Qt-efa4b886b173cb730e537cbc5afd3ac01ca8c78c.tar.gz Qt-efa4b886b173cb730e537cbc5afd3ac01ca8c78c.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public:
Fix regression on Symbian
Fix broken test case
Cleanup the deployment code
Fix 'make sis' finding the dll on symbian
Re-add line that was lost during webkit update.
Work around bad naming of exported class in symbian sdk causing conflict
Fix building on public symbian SDK.
Fix qmake with the symbian makespec failing when project has a dash in it
Make s60main static lib not depend on QtCore
Remove stray non-latin1 character
Fix out-of-source symbian build for external apps
Update EABI def files for 4.7
Exporting QFontDatabase::removeAllApplicationFonts()
Adding QFontDatabase::removeAllApplicationFonts()
Diffstat (limited to 'src/s60main/qts60main_mcrt0.cpp')
-rw-r--r-- | src/s60main/qts60main_mcrt0.cpp | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp index 66ce8b6..28c3ac6 100644 --- a/src/s60main/qts60main_mcrt0.cpp +++ b/src/s60main/qts60main_mcrt0.cpp @@ -40,7 +40,7 @@ // MCRT0.CPP // -// © Portions copyright (c) 2005-2006 Nokia Corporation. All rights reserved. +// Portions copyright (c) 2005-2006 Nokia Corporation. All rights reserved. // Copyright (c) Symbian Software Ltd 1997-2004. All rights reserved. // @@ -50,9 +50,8 @@ #include <exception> // must be before e32base.h so uncaught_exception gets defined #include <e32base.h> #include "estlib.h" +#include <string> -// Needed for QT_TRYCATCH_LEAVING. -#include <qglobal.h> #ifdef __ARMCC__ __asm int CallMain(int argc, char *argv[], char *envp[]) @@ -75,6 +74,18 @@ extern "C" GLDEF_C int __GccGlueInit() extern "C" IMPORT_C void exit(int ret); +namespace { +class QSymbianLeaveException : public std::exception +{ +public: + inline QSymbianLeaveException(int err) : error(err) {} + inline const char* what() const throw() { return "Symbian leave exception"; } + +public: + int error; +}; +} + GLDEF_C TInt QtMainWrapper() { int argc = 0; @@ -83,7 +94,37 @@ GLDEF_C TInt QtMainWrapper() // get args & environment __crt0(argc, argv, envp); //Call user(application)'s main - TRAPD(ret, QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp);)); + + TInt _err = KErrNone; + TRAPD(ret, + try { + ret = CALLMAIN(argc, argv, envp); + } catch (const std::exception &____ex) { + _err = KErrGeneral; + const std::type_info& type = typeid(____ex); + + if (type == typeid (std::bad_alloc)) { + _err = KErrNoMemory; + } else if (type == typeid(::QSymbianLeaveException)) { + _err = static_cast<const ::QSymbianLeaveException&>(____ex).error; + } else { + if (type == typeid(std::invalid_argument)) + _err = KErrArgument; + else if (type == typeid(std::out_of_range)) + // std::out_of_range is of type logic_error which by definition means that it is + // "presumably detectable before the program executes". + // std::out_of_range is used to report an argument is not within the expected range. + // The description of KErrArgument says an argument is out of range. Hence the mapping. + _err = KErrArgument; + else if (type == typeid(std::overflow_error)) + _err = KErrOverflow; + else if (type == typeid(std::underflow_error)) + _err = KErrUnderflow; + } + } + User::LeaveIfError(_err); + ); + delete[] argv; delete[] envp; return ret; |