From 7cf3a6bc7575ff65107b2bddde47a3e4f6e86cdf Mon Sep 17 00:00:00 2001 From: Jaakko Helanti Date: Tue, 24 Jan 2012 16:37:44 +0200 Subject: Catch exceptions inside QSymbianControl::Draw MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Code added to catch C++ exceptions and Symbian leaves inside QSymbianControl::Draw. This is a cosmetic fix to remove CONE 6 crashes currently in Symbian port. We'll still study the root cause of those crashes. Task-number: ou1cimx1#952828 Change-Id: I7b62309dd205d3b5dbad3d5477b47451dd7ff397 Reviewed-by: Pauli Järvinen Reviewed-by: Murray Read Reviewed-by: Pasi Pentikäinen (cherry picked from commit b5a0aeb4b26e709e0b6c15b3b9d5fdf58f3db3dd) --- src/gui/kernel/qapplication_s60.cpp | 16 +++++++++++++++- src/gui/kernel/qt_s60_p.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 3d901c4474..67cb6bd4a2 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1332,7 +1332,21 @@ TCoeInputCapabilities QSymbianControl::InputCapabilities() const } #endif -void QSymbianControl::Draw(const TRect& controlRect) const +void QSymbianControl::Draw(const TRect& aRect) const +{ + int leaveCode = 0; + int exceptionCode = 0; + // Implementation of CCoeControl::Draw() must never leave or throw exception. + // In native Symbian code this is considered a fatal error, and it causes + // process termination. + TRAP(leaveCode, QT_TRYCATCH_ERROR(exceptionCode, doDraw(aRect))); + if (leaveCode) + qWarning() << "QSymbianControl::doDraw leaved with code " << leaveCode; + else if (exceptionCode) + qWarning() << "QSymbianControl::doDraw threw exception with code " << exceptionCode; +} + +void QSymbianControl::doDraw(const TRect& controlRect) const { // Set flag to avoid calling DrawNow in window surface QWidget *window = qwidget->window(); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 8c2728a0db..4fd194625b 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -332,6 +332,7 @@ private: #endif bool isSplitViewWidget(QWidget *widget); bool hasFocusedAndVisibleChild(QWidget *parentWidget); + void doDraw(const TRect& aRect) const; public: void handleClientAreaChange(); -- cgit v1.2.1