summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@digia.com>2013-05-14 13:50:31 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-22 15:23:59 +0200
commitf3aad61120d5cc8029c7092b1f74e2b5b632f99b (patch)
treed2c2a340e1088b445875214c616e7244694d5805 /src/widgets
parent3c50917a6ac1ee7fd4707d69a8ca186343c21f91 (diff)
Fixed crash associated with reparenting a QGLWidget
We need to make sure that we don't reset() the context when the QGLWidget is being reparented, as that will lead to the QOpenGLContext being destroyed and not recreated, leading to a crash in makeCurrent(). Also, don't destroy() the widget if it has not yet been created, as in that case there's no ParentAboutToChange event sent. Task-number: QTBUG-31016 Change-Id: I409fff94456802a80bd72b470a6fbaee87505baa Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index 590ebed5eb..3b6c9ca448 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -263,10 +263,8 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide);
// Reparenting toplevel to child
- if (!(f&Qt::Window) && (oldFlags&Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow)) {
- //qDebug() << "setParent_sys() change from toplevel";
+ if (wasCreated && !(f & Qt::Window) && (oldFlags & Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow))
q->destroy();
- }
adjustFlags(f, q);
data.window_flags = f;