diff options
author | Wladimir Leuschner <wladimir.leuschner@qt.io> | 2023-07-24 13:57:54 +0200 |
---|---|---|
committer | Wladimir Leuschner <wladimir.leuschner@qt.io> | 2023-07-27 20:06:05 +0200 |
commit | 63824363ab4844816a4ea16a4d315c74ae21344a (patch) | |
tree | 9deade1281be3924572b5c55ebfeb67485078802 /src/gui/kernel/qwindow.cpp | |
parent | 58b5fb0f9944195b0a75b88d8ba952224d342421 (diff) |
Return 0 in QWindow::winId in case of failed platform window creation
Task-number: QTBUG-114613
Pick-to: 5.15 6.5 6.6
Change-Id: I93184d95f8f448ab115570a18cdb720449a0637d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index b59c32ac34..1e30e57baf 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -687,6 +687,7 @@ void QWindow::create() Returns the window's platform id. \note This function will cause the platform window to be created if it is not already. + Returns 0, if the platform window creation failed. For platforms where this id might be useful, the value returned will uniquely represent the window inside the corresponding screen. @@ -700,6 +701,9 @@ WId QWindow::winId() const if (!d->platformWindow) const_cast<QWindow *>(this)->create(); + if (!d->platformWindow) + return 0; + return d->platformWindow->winId(); } |