Skip to content

Commit 0806c62

Browse files
Timur PocheptsovTimur Pocheptsov
Timur Pocheptsov
authored and
Timur Pocheptsov
committed
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 <[email protected]>
1 parent ffb5ece commit 0806c62

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/gui/kernel/qwidget_mac.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3092,7 +3092,7 @@ void qt_mac_updateParentUnderAlienWidget(QWidget *alienWidget)
30923092

30933093
// Maintain the glWidgets list on parent change: add "our" gl widgets
30943094
// to the list on the new parent and grandparents.
3095-
if (glWidgets.isEmpty() == false) {
3095+
if (glWidgets.isEmpty() == false && !q->isWindow()) {
30963096
QWidget *current = q->parentWidget();
30973097
while (current) {
30983098
current->d_func()->glWidgets += glWidgets;

0 commit comments

Comments
 (0)