From 391c1c752baeec5818e849e3e13032a899d33362 Mon Sep 17 00:00:00 2001 From: Iain Date: Fri, 2 Apr 2010 09:18:44 +0100 Subject: Revert "Make s60main static lib not depend on QtCore" This reverts commit faff1c60a2a7f6ebef90249e759bdf822c8b17de. --- src/s60main/qts60main.cpp | 6 ++---- src/s60main/qts60main_mcrt0.cpp | 47 +++-------------------------------------- 2 files changed, 5 insertions(+), 48 deletions(-) diff --git a/src/s60main/qts60main.cpp b/src/s60main/qts60main.cpp index 7b85901..5fbeea5 100644 --- a/src/s60main/qts60main.cpp +++ b/src/s60main/qts60main.cpp @@ -41,7 +41,7 @@ // INCLUDE FILES #include // must be before e32base.h so uncaught_exception gets defined #include -#include +#include GLDEF_C TInt QtMainWrapper(); @@ -51,9 +51,7 @@ GLDEF_C TInt QtMainWrapper(); */ GLDEF_C TInt E32Main() { - CTrapCleanup *cleanupStack = CTrapCleanup::New(); - if (!(cleanupStack)) - throw std::bad_alloc(); + CTrapCleanup *cleanupStack = q_check_ptr(CTrapCleanup::New()); TInt err = 0; TRAP(err, err = QtMainWrapper()); delete cleanupStack; diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp index 28c3ac6..0f0723e 100644 --- a/src/s60main/qts60main_mcrt0.cpp +++ b/src/s60main/qts60main_mcrt0.cpp @@ -50,8 +50,9 @@ #include // must be before e32base.h so uncaught_exception gets defined #include #include "estlib.h" -#include +// Needed for QT_TRYCATCH_LEAVING. +#include #ifdef __ARMCC__ __asm int CallMain(int argc, char *argv[], char *envp[]) @@ -74,18 +75,6 @@ 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; @@ -94,37 +83,7 @@ GLDEF_C TInt QtMainWrapper() // get args & environment __crt0(argc, argv, envp); //Call user(application)'s main - - 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(____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); - ); - + TRAPD(ret, QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp);)); delete[] argv; delete[] envp; return ret; -- cgit v0.12