summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-10-26 13:58:31 (GMT)
committeraxis <qt-info@nokia.com>2009-10-26 16:17:49 (GMT)
commite4ea97959e1fbbc99e80023a6c3229ba0a1d7c8b (patch)
treeb4debb70a22dfcf44ad2d903df7deeb277503e82 /src/gui
parent91823996c00b1ba952be45eaa69a98816e6f27fd (diff)
downloadQt-e4ea97959e1fbbc99e80023a6c3229ba0a1d7c8b.zip
Qt-e4ea97959e1fbbc99e80023a6c3229ba0a1d7c8b.tar.gz
Qt-e4ea97959e1fbbc99e80023a6c3229ba0a1d7c8b.tar.bz2
Removed the need for extra Symbian traps after QApp construction.
This was achieved by putting back the old trap handler after the S60 framework construction has finished. Task: QTBUG-4960 AutoTest: Included and passed RevBy: Shane Kearns
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qapplication_s60.cpp13
-rw-r--r--src/gui/kernel/qt_s60_p.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 689429e..30bf99a 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1030,6 +1030,14 @@ QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int
void qt_init(QApplicationPrivate * /* priv */, int)
{
if (!CCoeEnv::Static()) {
+ // The S60 framework creates a new trap handler which will render any existing traps
+ // invalid as long as it is active. This means that all code in main() that occurs after
+ // the QApplication construction needs to be surrounded by a new trap, despite having
+ // an outer one already. To avoid this, we save the original trap handler here, and set
+ // it back after the S60 framework is constructed. Then we restore it right before the S60
+ // framework destruction.
+ TTrapHandler *origTrapHandler = User::TrapHandler();
+
// The S60 framework has not been initalized. We need to do it.
TApaApplicationFactory factory(S60->s60ApplicationFactory ?
S60->s60ApplicationFactory : newS60Application);
@@ -1041,6 +1049,8 @@ void qt_init(QApplicationPrivate * /* priv */, int)
QT_TRAP_THROWING(coe->ConstructAppFromCommandLineL(factory,*commandLine));
delete commandLine;
+ S60->s60InstalledTrapHandler = User::SetTrapHandler(origTrapHandler);
+
S60->qtOwnsS60Environment = true;
} else {
S60->qtOwnsS60Environment = false;
@@ -1195,6 +1205,9 @@ void qt_cleanup()
S60->wsSession().SetPointerCursorMode(EPointerCursorNone);
if (S60->qtOwnsS60Environment) {
+ // Restore the S60 framework trap handler. See qt_init().
+ User::SetTrapHandler(S60->s60InstalledTrapHandler);
+
CEikonEnv* coe = CEikonEnv::Static();
coe->PrepareToExit();
// The CEikonEnv itself is destroyed in here.
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index e25bc81..789d89e 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -124,6 +124,8 @@ public:
static inline CAknTitlePane* titlePane();
static inline CAknContextPane* contextPane();
static inline CEikButtonGroupContainer* buttonGroupContainer();
+
+ TTrapHandler *s60InstalledTrapHandler;
#endif
};