summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-05-03 10:36:08 (GMT)
committerQt Commercial Integration <QtCommercial@digia.com>2012-01-31 10:24:38 (GMT)
commit35e19b15241777d4339746a8b8d3ecca313cd3cf (patch)
tree700891840be0e0c307aa40d9affa03a1c01804ff
parent1d490aa71dae1041cf51053c4e12800388ca92be (diff)
downloadQt-35e19b15241777d4339746a8b8d3ecca313cd3cf.zip
Qt-35e19b15241777d4339746a8b8d3ecca313cd3cf.tar.gz
Qt-35e19b15241777d4339746a8b8d3ecca313cd3cf.tar.bz2
Fixed bug in X11 backend when creating translucent windows.
We forgot to send the ParentAboutToChange event, which meant QGLWidget didn't destroy the old EGL surface. This could cause two EGL surfaces to be created for the same QGLWidget, which leads to undefined behaviour on some platforms.
-rw-r--r--src/gui/kernel/qwidget_x11.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 65d9837..ef53477 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -939,8 +939,13 @@ static void qt_x11_recreateWidget(QWidget *widget)
// recreate their GL context, which in turn causes them to choose
// their visual again. Now that WA_TranslucentBackground is set,
// QGLContext::chooseVisual will select an ARGB visual.
- QEvent e(QEvent::ParentChange);
- QApplication::sendEvent(widget, &e);
+
+ // QGLWidget expects a ParentAboutToChange to be sent first
+ QEvent aboutToChangeEvent(QEvent::ParentAboutToChange);
+ QApplication::sendEvent(widget, &aboutToChangeEvent);
+
+ QEvent parentChangeEvent(QEvent::ParentChange);
+ QApplication::sendEvent(widget, &parentChangeEvent);
} else {
// For regular widgets, reparent them with their parent which
// also triggers a recreation of the native window