summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond@trolltech.com>2009-10-06 08:40:04 (GMT)
committerTrond Kjernåsen <trond@trolltech.com>2009-10-06 08:43:24 (GMT)
commit6d56096ba0f88e25efd77072f58804dd1f160c0a (patch)
tree8f17bcd73e8eda14c0d295c9d675eb76924e3942
parentb7503346c1b7d245625b1b9e7cf7ae89a86467f0 (diff)
downloadQt-6d56096ba0f88e25efd77072f58804dd1f160c0a.zip
Qt-6d56096ba0f88e25efd77072f58804dd1f160c0a.tar.gz
Qt-6d56096ba0f88e25efd77072f58804dd1f160c0a.tar.bz2
Fixed the X11 error output from the demos/boxes demo.
After we started caching the current context internally, it revealed an old bug: when a QGLWidget is reparented under X11, it will get a new window id, but its context will still be bound to the old window, so we need to rebind it. Reviewed-by: Samuel
-rw-r--r--src/opengl/qgl.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 7dbe642..3940a08 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -3781,6 +3781,11 @@ bool QGLWidget::event(QEvent *e)
glFinish();
doneCurrent();
} else if (e->type() == QEvent::ParentChange) {
+ // if we've reparented a window that has the current context
+ // bound, we need to rebind that context to the new window id
+ if (d->glcx == QGLContext::currentContext())
+ makeCurrent();
+
if (d->glcx->d_func()->screen != d->xinfo.screen() || testAttribute(Qt::WA_TranslucentBackground)) {
setContext(new QGLContext(d->glcx->requestedFormat(), this));
// ### recreating the overlay isn't supported atm