qpa: Verify that the platform returns a WId that is not WId(0)

This is motivated by visiting a customer that re-implemented the
::winId method and returned WId(0) that resulted in a crash. Currently
there is only a comment inside the implementation of the ::winId
default implementation. Add a note to the API documentation, add
a Q_ASSERT to check if our assumption holds true.

Change-Id: I8607a4efc4f561f7849c976cd2454f6fbcb20eaa
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
bb10
Holger Hans Peter Freyther 2012-02-01 13:32:53 +01:00 committed by Qt by Nokia
parent ad1a013878
commit 3ad9896361
1 changed files with 5 additions and 1 deletions

View File

@ -220,7 +220,11 @@ WId QWindow::winId() const
Q_D(const QWindow);
if(!d->platformWindow)
const_cast<QWindow *>(this)->create();
return d->platformWindow->winId();
WId id = d->platformWindow->winId();
// See the QPlatformWindow::winId() documentation
Q_ASSERT(id != WId(0));
return id;
}
QWindow *QWindow::parent() const