Fix crash due to use of native widgets on Windows
Qt has corner cases when all of its widgets are native widgets. This particular crash was a loop between QWidget::create() and QWidget::createWinId().
This commit is contained in:
@@ -788,6 +788,12 @@ static QWidgetOrQuick *qtTopLevelForHWND(HWND hwnd)
|
||||
// Case not supported for QtQuick.
|
||||
const QWidgetList widgets = qApp->topLevelWidgets();
|
||||
for (QWidget *widget : widgets) {
|
||||
if (!widget->windowHandle()) {
|
||||
// Don't call winId on windows that don't have it, as that will force all its childrens to have it,
|
||||
// and that's not very stable. a top level might not have one because it's being destroyed, or because
|
||||
// it's a top-level just because it has't been reparented I guess.
|
||||
continue;
|
||||
}
|
||||
if (hwnd == ( HWND )widget->winId()) {
|
||||
return widget;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user