From 0806c624bb3e29c0ca852def079f21bc56174be6 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 2 Mar 2015 15:52:19 +0100 Subject: QGLWidget and re-parenting On OS X we have QWidgetPrivate::glWidgets list to track all child gl-widgets and this propagates though all the widget's tree, starting from QGLWidget and up to the top-level window ('isWindow'). It can happen, that some of widgets in a chain is becoming a window (but still has a parent) - this results in QGLWidget's destructor failing to remove 'this' from one of ancestors (since it stops on the first 'isWindow' ancestor). Modify QWidgetPrivate::setParent_sys that it does NOT add glWidgets into the parent's glWidgets, if this widget isWindow itself. Change-Id: I4bf4a927a4e43537355fdcdef465638c91e9f956 Task-number: QTBUG-20652 Reviewed-by: Gabriel de Dietrich --- src/gui/kernel/qwidget_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 7e9ebb9..16ec3d8 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3092,7 +3092,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // Maintain the glWidgets list on parent change: add "our" gl widgets // to the list on the new parent and grandparents. - if (glWidgets.isEmpty() == false) { + if (glWidgets.isEmpty() == false && !q->isWindow()) { QWidget *current = q->parentWidget(); while (current) { current->d_func()->glWidgets += glWidgets; -- cgit v0.12