diff options
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index dbacfba4a8..e262f3f8a4 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -389,25 +389,31 @@ void QWindowPrivate::setTopLevelScreen(QScreen *newScreen, bool recreate) void QWindowPrivate::create(bool recursive) { Q_Q(QWindow); + if (platformWindow) + return; + + platformWindow = QGuiApplicationPrivate::platformIntegration()->createPlatformWindow(q); + Q_ASSERT(platformWindow); + if (!platformWindow) { - platformWindow = QGuiApplicationPrivate::platformIntegration()->createPlatformWindow(q); - QObjectList childObjects = q->children(); - for (int i = 0; i < childObjects.size(); i ++) { - QObject *object = childObjects.at(i); - if (object->isWindowType()) { - QWindow *window = static_cast<QWindow *>(object); - if (recursive) - window->d_func()->create(true); - if (window->d_func()->platformWindow) - window->d_func()->platformWindow->setParent(platformWindow); - } - } + qWarning() << "Failed to create platform window for" << q << "with flags" << q->flags(); + return; + } - if (platformWindow) { - QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated); - QGuiApplication::sendEvent(q, &e); + QObjectList childObjects = q->children(); + for (int i = 0; i < childObjects.size(); i ++) { + QObject *object = childObjects.at(i); + if (object->isWindowType()) { + QWindow *window = static_cast<QWindow *>(object); + if (recursive) + window->d_func()->create(true); + if (window->d_func()->platformWindow) + window->d_func()->platformWindow->setParent(platformWindow); } } + + QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated); + QGuiApplication::sendEvent(q, &e); } void QWindowPrivate::clearFocusObject() |