summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2011-07-18 08:53:06 (GMT)
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>2011-07-18 10:08:18 (GMT)
commit4e910f7d00dc3a08a2ac8578ecc8e0284b407bb9 (patch)
tree7d28e120ce3c700cfe5baa9522a007b1408f53b2
parentb05a513e1427dacc4c3de1b6d507616764248b96 (diff)
downloadQt-4e910f7d00dc3a08a2ac8578ecc8e0284b407bb9.zip
Qt-4e910f7d00dc3a08a2ac8578ecc8e0284b407bb9.tar.gz
Qt-4e910f7d00dc3a08a2ac8578ecc8e0284b407bb9.tar.bz2
Avoid crash when surface creation fails.
When the creation of the EGL window surface failed, the paint engine was not destroyed in the openvg module's window surface implementation. This led to accessing an obsolete engine instance later on in QSymbianControl::Draw, leading to a crash. Now a new, proper engine will be created, naturally the painting will still fail, but the application will not crash. Task-number: QTBUG-20339 Reviewed-by: Jani Hautakangas
-rw-r--r--src/openvg/qwindowsurface_vgegl.cpp2
-rw-r--r--src/openvg/qwindowsurface_vgegl_p.h4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp
index f7961b4..e16eeb3 100644
--- a/src/openvg/qwindowsurface_vgegl.cpp
+++ b/src/openvg/qwindowsurface_vgegl.cpp
@@ -686,6 +686,8 @@ QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget)
#endif
EGLSurface surface = context->createSurface(widget, &surfaceProps);
if (surface == EGL_NO_SURFACE) {
+ qt_vg_destroy_paint_engine(engine);
+ engine = 0;
qt_vg_destroy_context(context, QInternal::Widget);
context = 0;
return 0;
diff --git a/src/openvg/qwindowsurface_vgegl_p.h b/src/openvg/qwindowsurface_vgegl_p.h
index 231c548..2226e28 100644
--- a/src/openvg/qwindowsurface_vgegl_p.h
+++ b/src/openvg/qwindowsurface_vgegl_p.h
@@ -80,10 +80,8 @@ public:
virtual bool supportsStaticContents() const { return false; }
virtual bool scroll(QWidget *, const QRegion&, int, int) { return false; }
-private:
- QVGPaintEngine *engine;
-
protected:
+ QVGPaintEngine *engine;
QWindowSurface *winSurface;
void destroyPaintEngine();