summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorPauli Jarvinen <ext-pauli.p.jarvinen@nokia.com>2012-02-03 12:14:05 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-02-08 12:19:04 (GMT)
commitf0d703557322d1b536e72bbba8209f6a615f6dc1 (patch)
tree24f04fca831b23fea4728f5d841dff33cfba478c /src/gui/painting
parentd5649547d641b9c5af3c3f814caf8e1ab5bf9f47 (diff)
downloadQt-f0d703557322d1b536e72bbba8209f6a615f6dc1.zip
Qt-f0d703557322d1b536e72bbba8209f6a615f6dc1.tar.gz
Qt-f0d703557322d1b536e72bbba8209f6a615f6dc1.tar.bz2
Prevent crashing on Symbian in case EGL surface creation fails.
It is possible in environment with limited resources, that EGL surface creation fails. When this happens, the QPainter doesn't get properly activated, which in turn caused a crash later in the drawing code. Now, a check has been added into qapplication_s60.cpp to abort window drawing immediately, if surface creation has failed. The EGL surface is then tried to be recreated on the next time when the window becomes visible, which usually allows the application to recover. In most cases, the crash happened in the function qDrawBorderPixmap, which didn't check the validity of the QPaintEngine pointer before accessing it. This method is analogous with the public methods of the class QPainter where, on the other hand, availability of QPaintEngine was always checked. To be in line, and to prevent ptential crashes, a similar safety check and warning message have now been added to method qDrawBorderPixmap. Furthermore, a null-check was added to qwindowsurface_gl.cpp for the QGLContext pointer. The same pointer was already previously null-checked in the other branch of the same function, indicating that the null-check is probably necessary. Task-number: ou1cimx1#969923 Change-Id: I6d78be72b9c2308ef74b1119d8c8ec34ec015195 Reviewed-by: Jaakko Helanti <ext-jaakko.helanti@nokia.com> Reviewed-by: Pasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qdrawutil.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp
index 2f5babf..1facd8f 100644
--- a/src/gui/painting/qdrawutil.cpp
+++ b/src/gui/painting/qdrawutil.cpp
@@ -1105,6 +1105,11 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
const QPixmap &pixmap, const QRect &sourceRect,const QMargins &sourceMargins,
const QTileRules &rules, QDrawBorderPixmap::DrawingHints hints)
{
+ if (!painter->isActive()) {
+ qWarning("qDrawBorderPixmap: Painter not active");
+ return;
+ }
+
QRectFArray sourceData[2];
QRectFArray targetData[2];