diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2012-02-01 13:32:53 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-20 09:36:51 +0100 |
commit | 3ad9896361ef9382f44a5cfaa80431fe6ea3e1f9 (patch) | |
tree | b37bb6a2657c7140b2480704663db35989e7afb6 /src | |
parent | ad1a0138789041f4cb7083ea68168a4b9316dd99 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 5b6ee0e9cb..85f12dd023 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -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 |