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>
This commit is contained in:
Wladimir Leuschner 2023-07-24 13:57:54 +02:00
parent 58b5fb0f99
commit 63824363ab

View File

@ -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();
}