diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2010-11-26 14:59:30 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2010-11-26 15:06:05 (GMT) |
commit | 71abe300263d9f6bcd6e061e889a58111c48f92a (patch) | |
tree | 1d56f5244b8336de0b64e6e3131b8cedb514be6a /src/gui/kernel | |
parent | 896c51e4d41a7fee06a1601f1b25746f9f98be88 (diff) | |
download | Qt-71abe300263d9f6bcd6e061e889a58111c48f92a.zip Qt-71abe300263d9f6bcd6e061e889a58111c48f92a.tar.gz Qt-71abe300263d9f6bcd6e061e889a58111c48f92a.tar.bz2 |
Make QtOpenGL use shared contextexts on Lighthouse
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qplatformglcontext_qpa.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_qpa.cpp | 24 |
2 files changed, 18 insertions, 12 deletions
diff --git a/src/gui/kernel/qplatformglcontext_qpa.cpp b/src/gui/kernel/qplatformglcontext_qpa.cpp index 5d2faf1..14bd718 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.cpp +++ b/src/gui/kernel/qplatformglcontext_qpa.cpp @@ -180,7 +180,11 @@ void QPlatformGLContext::setQGLContextHandle(void *handle,void (*qGLContextDelet void QPlatformGLContext::deleteQGLContext() { Q_D(QPlatformGLContext); - d->qGLContextDeleteFunction(d->qGLContextHandle); + if (d->qGLContextDeleteFunction && d->qGLContextHandle) { + d->qGLContextDeleteFunction(d->qGLContextHandle); + d->qGLContextDeleteFunction = 0; + d->qGLContextHandle = 0; + } } /*! diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index aa6b3f8..1f2a764 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -98,10 +98,12 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } Q_ASSERT(platformWindow); - if (!surface && platformWindow && q->platformWindowFormat().hasWindowSurface()) { - surface = QApplicationPrivate::platformIntegration()->createWindowSurface(q,platformWindow->winId()); - } else { - q->setAttribute(Qt::WA_PaintOnScreen,true); + if (!surface ) { + if (platformWindow && q->platformWindowFormat().hasWindowSurface()) { + surface = QApplicationPrivate::platformIntegration()->createWindowSurface(q,platformWindow->winId()); + } else { + q->setAttribute(Qt::WA_PaintOnScreen,true); + } } data.window_flags = q->platformWindow()->setWindowFlags(data.window_flags); @@ -787,13 +789,13 @@ void QWidgetPrivate::createTLSysExtra() void QWidgetPrivate::deleteTLSysExtra() { if (extra && extra->topextra) { - if (extra->topextra->platformWindowFormat.windowApi() == QPlatformWindowFormat::OpenGL) { - //the toplevel might have a context with a "qglcontext assosiated with it. We need to - //delete the qglcontext before we delete the qplatformglcontext. - if (extra->topextra->platformWindow) { - if (QPlatformGLContext *context = extra->topextra->platformWindow->glContext()) { - context->deleteQGLContext(); - } + //the toplevel might have a context with a "qglcontext assosiated with it. We need to + //delete the qglcontext before we delete the qplatformglcontext. + //One unfortunate thing about this is that we potentially create a glContext just to + //delete it straight afterwards. + if (extra->topextra->platformWindow) { + if (QPlatformGLContext *context = extra->topextra->platformWindow->glContext()) { + context->deleteQGLContext(); } } delete extra->topextra->platformWindow; |