diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-10-28 08:42:51 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-10-28 08:42:51 (GMT) |
commit | cb821260e092679320c759406b503a4a44db998f (patch) | |
tree | b1a69255b2f3908c1fca6038d31f462ca0adb574 /src/gui/kernel/qapplication_s60.cpp | |
parent | e6767a4bd15f001df6927d7232598662977bea13 (diff) | |
parent | 1583d643285641bf71e6a107331d788acca9850c (diff) | |
download | Qt-cb821260e092679320c759406b503a4a44db998f.zip Qt-cb821260e092679320c759406b503a4a44db998f.tar.gz Qt-cb821260e092679320c759406b503a4a44db998f.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/gui/kernel/qapplication_s60.cpp')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 13 |
1 files changed, 13 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. |