summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIain <qt-info@nokia.com>2010-04-02 08:18:44 (GMT)
committerIain <qt-info@nokia.com>2010-04-02 08:18:44 (GMT)
commit391c1c752baeec5818e849e3e13032a899d33362 (patch)
tree904bfca11a7ec5010db2d7f33ee1352823c7afe5 /src
parentefa4b886b173cb730e537cbc5afd3ac01ca8c78c (diff)
downloadQt-391c1c752baeec5818e849e3e13032a899d33362.zip
Qt-391c1c752baeec5818e849e3e13032a899d33362.tar.gz
Qt-391c1c752baeec5818e849e3e13032a899d33362.tar.bz2
Revert "Make s60main static lib not depend on QtCore"
This reverts commit faff1c60a2a7f6ebef90249e759bdf822c8b17de.
Diffstat (limited to 'src')
-rw-r--r--src/s60main/qts60main.cpp6
-rw-r--r--src/s60main/qts60main_mcrt0.cpp47
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 <exception> // must be before e32base.h so uncaught_exception gets defined
#include <e32base.h>
-#include <string>
+#include <qglobal.h>
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 <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[])
@@ -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<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);
- );
-
+ TRAPD(ret, QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp);));
delete[] argv;
delete[] envp;
return ret;