summaryrefslogtreecommitdiffstats
path: root/src/opengl
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/opengl
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/opengl')
-rw-r--r--src/opengl/qwindowsurface_gl.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index c39eb53..81e857f 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -693,6 +693,11 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
}
QGLContext *ctx = reinterpret_cast<QGLContext *>(parent->d_func()->extraData()->glContext);
+#ifdef Q_OS_SYMBIAN
+ if (!ctx)
+ return;
+#endif
+
if (widget != window()) {
if (initializeOffscreenTexture(window()->size()))
qWarning() << "QGLWindowSurface: Flushing to native child widget, may lead to significant performance loss";