diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-11-10 13:05:20 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-11-10 13:05:20 (GMT) |
commit | 8cd2af3982a79b72c0d795e5952e1822b023110f (patch) | |
tree | 4b681b0a480f880373242f0f396a811ec6bcc1f5 /src | |
parent | 50adee71e94e13a04b5da9cc4975a897bcdb0477 (diff) | |
parent | 865ccc15029d49e72a16a20cc72c268b0e9944c2 (diff) | |
download | Qt-8cd2af3982a79b72c0d795e5952e1822b023110f.zip Qt-8cd2af3982a79b72c0d795e5952e1822b023110f.tar.gz Qt-8cd2af3982a79b72c0d795e5952e1822b023110f.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging:
Fix to QtOpenGL crash on Symbian
Diffstat (limited to 'src')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 4 | ||||
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 31 |
2 files changed, 32 insertions, 3 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index f5fe739..2db5b79 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -2108,6 +2108,10 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) return false; d->ctx = d->device->context(); +#ifdef Q_OS_SYMBIAN + if (!d->ctx) + return false; +#endif d->ctx->d_ptr->active_engine = this; const QSize sz = d->device->size(); diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index d93efb4..e963f8c 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -192,6 +192,14 @@ public: if (!initializing && !widget && !cleanedUp) { initializing = true; widget = new QGLWidget(QGLFormat(QGL::SingleBuffer | QGL::NoDepthBuffer | QGL::NoStencilBuffer)); +#ifdef Q_OS_SYMBIAN + if (!widget->context()->isValid()) { + delete widget; + widget = 0; + initializing = false; + return 0; + } +#endif widget->resize(1, 1); // We don't need this internal widget to appear in QApplication::topLevelWidgets() @@ -369,7 +377,7 @@ QGLWindowSurface::~QGLWindowSurface() #ifdef Q_OS_SYMBIAN // Destroy the context if necessary. - if (!qt_gl_share_widget()->context()->isSharing()) + if (qt_gl_share_widget() && !qt_gl_share_context()->isSharing()) qt_destroy_gl_share_widget(); #endif } @@ -420,7 +428,12 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) ctx = new QGLContext(surfaceFormat, widget); ctx->create(qt_gl_share_context()); - +#ifdef Q_OS_SYMBIAN + if (!ctx->isValid()) { + delete ctx; + return; + } +#endif #ifndef QT_NO_EGL static bool checkedForNOKSwapRegion = false; static bool haveNOKSwapRegion = false; @@ -468,6 +481,10 @@ QPaintDevice *QGLWindowSurface::paintDevice() { updateGeometry(); +#ifdef Q_OS_SYMBIAN + // On symbian we always return glDevice, even if it's invalid + return &d_ptr->glDevice; +#else if (d_ptr->pb) return d_ptr->pb; @@ -479,6 +496,7 @@ QPaintDevice *QGLWindowSurface::paintDevice() Q_ASSERT(d_ptr->fbo); return d_ptr->fbo; +#endif } static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize, const QRectF &src = QRectF()); @@ -693,6 +711,10 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & QGLContext *previous_ctx = const_cast<QGLContext *>(QGLContext::currentContext()); QGLContext *ctx = reinterpret_cast<QGLContext *>(parent->d_func()->extraData()->glContext); +#ifdef Q_OS_SYMBIAN + if (!ctx) + return; +#endif // QPainter::end() should have unbound the fbo, otherwise something is very wrong... Q_ASSERT(!d_ptr->fbo || !d_ptr->fbo->isBound()); @@ -892,7 +914,10 @@ void QGLWindowSurface::updateGeometry() { hijackWindow(window()); QGLContext *ctx = reinterpret_cast<QGLContext *>(wd->extraData()->glContext); - +#ifdef Q_OS_SYMBIAN + if (!ctx) + return; +#endif #ifdef Q_WS_MAC ctx->updatePaintDevice(); #endif |