Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.15.0
-
None
-
d73497cf770c92e38903850267fd8737df3578ca
Description
Sometimes calls to widget->setParent(parent_widget, flags) goes into an infinite recursion inside libQt5Widgets.so.5. I haven't tracked down what happens yet, I haven't found a way to reproduce it, but it might be that widget->parentWidget()==parent_widget.
You do check for this condition (widget->parentWidget()==parent_widget) in QWidget::setParent(QWidget*): https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/kernel/qwidget.cpp#n10298), but not in QWidget::setParent(QWidget*, Qt::WindowFlags): https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/kernel/qwidget.cpp#n10326
I suggest moving the check in setParent(QWidget*) to setParent(QWidget*, Qt::WindowFlags). At least, both methods should behave the same.