summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Read <ext-murray.2.read@nokia.com>2012-01-26 12:33:39 +0000
committerPasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com>2012-01-30 11:24:48 +0100
commit25cc8cae506fe70eae02091aebd36808f62da0d0 (patch)
tree0902b31deb290f7334bce1e44920ca40b96c1edd
parent8eaa6b90633a3696dbb30245a92a65b084b53c34 (diff)
downloadqt4-tools-25cc8cae506fe70eae02091aebd36808f62da0d0.tar.gz
Fix exception handling in Symbian event dispatcher
The Symbian event dispatcher handles exceptions from active objects as well as leaves. But if the active object throws while it has something pushed on the cleanup stack, the exception must be converted to a leave for the cleanup to happen and the cleanup stack balance to be maintained. Task-number: ou1cimx1#970701 Change-Id: I6c8eed61cb1666e36eb4858a2c72ad0d8c6b0c8f Reviewed-by: Shane Kearns <ext-shane.2.kearns@nokia.com> (cherry picked from commit 8c5614dda55ed7b539e06a3846618df8255dd18c) Reviewed-by: Pasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com>
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp2
-rw-r--r--tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp10
2 files changed, 11 insertions, 1 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
index da6f021f99..1052043034 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -824,7 +824,7 @@ QtRRActiveScheduler::RunResult QtRRActiveScheduler::RunMarkedIfReady(TInt &runPr
runPriority = active->Priority();
dataAccess->iStatus.iFlags&=~TRequestStatusAccess::ERequestActiveFlags;
int vptr = *(int*)active; // vptr can be used to identify type when debugging leaves
- TRAP(error, QT_TRYCATCH_ERROR(error, active->RunL()));
+ TRAP(error, QT_TRYCATCH_LEAVING(active->RunL()));
if (error!=KErrNone)
error=active->RunError(error);
if (error) {
diff --git a/tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp b/tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp
index 5ccfdabbd3..02eb62d8c7 100644
--- a/tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp
+++ b/tests/auto/symbian/qmainexceptions/tst_qmainexceptions.cpp
@@ -163,6 +163,7 @@ private slots:
void leave();
void testTranslateBadAlloc();
void testTranslateBigAlloc();
+ void testExceptionFromAO();
void testRoundTrip();
void testTrap();
void testPropagation();
@@ -327,6 +328,15 @@ void tst_qmainexceptions::testTranslateBigAlloc()
TestSchedulerCatchesError(&TranslateBigAllocL, KErrNoMemory);
}
+void tst_qmainexceptions::testExceptionFromAO()
+{
+ CTestActive *act = new(ELeave) CTestActive(&ThrowBadAlloc, true);
+ act->Test();
+ QCOMPARE(act->error, KErrNoMemory);
+ QVERIFY(act->cleanedUp);
+ delete act;
+}
+
void tst_qmainexceptions::TestSymbianRoundTrip(int leave, int trap)
{
// check that leave converted to exception, converted to error gives expected error code