summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget_x11.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-05-03 10:36:08 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-05-03 10:36:08 (GMT)
commit5a834d7141cc7d29d022911ccec16e628d94acf1 (patch)
treeff12e48388e2b4e38c0fce303d041c47b8f1d86a /src/gui/kernel/qwidget_x11.cpp
parent8680d831fb7066feae07690a4a6bc8e908a84e5a (diff)
downloadQt-5a834d7141cc7d29d022911ccec16e628d94acf1.zip
Qt-5a834d7141cc7d29d022911ccec16e628d94acf1.tar.gz
Qt-5a834d7141cc7d29d022911ccec16e628d94acf1.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.
Diffstat (limited to 'src/gui/kernel/qwidget_x11.cpp')
-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 5ece7d6..a49a607 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -954,8 +954,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