From ddbcf783086941d6c189cd4822ac9fa63b35af34 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Fri, 6 Sep 2013 08:32:09 +0300 Subject: [PATCH] Move winId!=0 assertion from QWindow to QWidget In "very basic platform plugins", the platform window ID can be null, which conflicts with QWidget's special treatment of 0 as a parented widget. Such is the case with EGLFS, which can return a null native window handle for winId on some EGL implementations. Move the assertion winId!=0 into the widget framework, as this assert is not relevant for non-widget applications. A large proportion of basic platform plugin users will see relief from this unnecessary assertion. Change-Id: I25c9d96550cd747c77c9516d773e9cdebf7440ab Reviewed-by: Gunnar Sletta Reviewed-by: Robin Burchell --- src/gui/kernel/qwindow.cpp | 5 +---- src/widgets/kernel/qwidget_qpa.cpp | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 490cf0c110..11a6238fa1 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -502,10 +502,7 @@ WId QWindow::winId() const if(!d->platformWindow) const_cast(this)->create(); - WId id = d->platformWindow->winId(); - // See the QPlatformWindow::winId() documentation - Q_ASSERT(id != WId(0)); - return id; + return d->platformWindow->winId(); } /*! diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 665aa4b17a..a06283be02 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -153,7 +153,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } setWindowModified_helper(); - setWinId(win->winId()); + WId id = win->winId(); + // See the QPlatformWindow::winId() documentation + Q_ASSERT(id != WId(0)); + setWinId(id); // Check children and create windows for them if necessary q_createNativeChildrenAndSetParent(q);