summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond@trolltech.com>2009-10-06 08:40:04 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-10-07 02:31:40 (GMT)
commit2065122db7a12a133f082cb21582c9a853dddd2d (patch)
tree8a369849cdd02fa368ac7dd95afe2e71556843da
parent3e37395c10c15db20dff89afece0392aae4fd407 (diff)
downloadQt-2065122db7a12a133f082cb21582c9a853dddd2d.zip
Qt-2065122db7a12a133f082cb21582c9a853dddd2d.tar.gz
Qt-2065122db7a12a133f082cb21582c9a853dddd2d.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 (cherry picked from commit 6d56096ba0f88e25efd77072f58804dd1f160c0a)
-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