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.
(cherry picked from commit 5a834d7141cc7d29d022911ccec16e628d94acf1)
This commit is contained in:
Samuel Rødal 2011-05-03 12:36:08 +02:00 committed by Olivier Goffart
parent 3a0f5d04fc
commit 978fc98bff

View File

@ -952,8 +952,13 @@ static void qt_x11_recreateWidget(QWidget *widget)
// recreate their GL context, which in turn causes them to choose // recreate their GL context, which in turn causes them to choose
// their visual again. Now that WA_TranslucentBackground is set, // their visual again. Now that WA_TranslucentBackground is set,
// QGLContext::chooseVisual will select an ARGB visual. // 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 { } else {
// For regular widgets, reparent them with their parent which // For regular widgets, reparent them with their parent which
// also triggers a recreation of the native window // also triggers a recreation of the native window