From 24a928dd31ea54063b802cc2d249afe852daeebe Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 22 Sep 2009 15:06:32 +0200 Subject: Fix crashes in QApplication autotest 1) Input methods caused crash due to using CCoeEnv::Fep() without checking for NULL pointer 2) Autotest itself had Q_ASSERT where it should have used Q_VERIFY Reviewed-by: axis --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 8 ++++++-- tests/auto/qapplication/tst_qapplication.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index b198ae1..fc55a0f 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -98,7 +98,9 @@ QCoeFepInputContext::~QCoeFepInputContext() void QCoeFepInputContext::reset() { - CCoeEnv::Static()->Fep()->CancelTransaction(); + CCoeFep* fep = CCoeEnv::Static()->Fep(); + if (fep) + fep->CancelTransaction(); } void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType) @@ -626,7 +628,9 @@ void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian) m_isEditing = false; if (!triggeredBySymbian) { - CCoeEnv::Static()->Fep()->CancelTransaction(); + CCoeFep* fep = CCoeEnv::Static()->Fep(); + if (fep) + fep->CancelTransaction(); } } diff --git a/tests/auto/qapplication/tst_qapplication.cpp b/tests/auto/qapplication/tst_qapplication.cpp index 6ffefc5..2ba5239 100644 --- a/tests/auto/qapplication/tst_qapplication.cpp +++ b/tests/auto/qapplication/tst_qapplication.cpp @@ -1148,15 +1148,15 @@ void DeleteLaterWidget::runTest() connect(w, SIGNAL(destroyed()), this, SLOT(childDeleted())); w->deleteLater(); - Q_ASSERT(!child_deleted); + QVERIFY(!child_deleted); QDialog dlg; QTimer::singleShot(500, &dlg, SLOT(reject())); dlg.exec(); - Q_ASSERT(!child_deleted); + QVERIFY(!child_deleted); app->processEvents(); - Q_ASSERT(!child_deleted); + QVERIFY(!child_deleted); QTimer::singleShot(500, this, SLOT(checkDeleteLater())); @@ -1167,7 +1167,7 @@ void DeleteLaterWidget::runTest() void DeleteLaterWidget::checkDeleteLater() { - Q_ASSERT(child_deleted); + QVERIFY(child_deleted); close(); } -- cgit v0.12