diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2023-10-04 08:53:35 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-11-11 18:31:18 +0000 |
commit | 2cbb620b2c62644d6aa849fbf2ef8d5ab763f16c (patch) | |
tree | aa94267ea795661d25fd4a1682fc730096e108e8 | |
parent | 5163615d6404ee4df5754f629298b1f2290514f3 (diff) |
NativeSkiaOutputDevice: handle errors on creating a shared texture
Avoid asserting or crashing on nullptr access after failure,.
Task-number: QTBUG-116445
Pick-to: 6.5
Change-Id: I75a99c97acfe07b4328be075b0f75df5f2357dbe
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
(cherry picked from commit 2ec0171d43e5377d9fe264d5f5c97e85a42e1191)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/core/compositor/native_skia_output_device.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/compositor/native_skia_output_device.cpp b/src/core/compositor/native_skia_output_device.cpp index ef38feecc..3067e14a7 100644 --- a/src/core/compositor/native_skia_output_device.cpp +++ b/src/core/compositor/native_skia_output_device.cpp @@ -17,6 +17,7 @@ #include "ui/gl/gl_fence.h" #if defined(Q_OS_WIN) +#include <QtCore/private/qsystemerror_p.h> #include <QtQuick/qsgtexture.h> #include <d3d11_1.h> #endif @@ -413,7 +414,14 @@ QSGTexture *NativeSkiaOutputDevice::texture(QQuickWindow *win, uint32_t textureO ID3D11Texture2D *qtTexture; status = device->OpenSharedResource1(sharedHandle, __uuidof(ID3D11Texture2D), (void**)&qtTexture); - Q_ASSERT(status == S_OK); + if (status != S_OK) { + qWarning("Failed to share D3D11 texture (%s). This will result in failed rendering. Report the bug, and try restarting with QTWEBENGINE_CHROMIUM_FLAGS=--disble-gpu", + qPrintable(QSystemError::windowsComString(status))); + ::CloseHandle(sharedHandle); + return nullptr; + } + + Q_ASSERT(qtTexture); QQuickWindow::CreateTextureOptions texOpts(textureOptions); texture = QNativeInterface::QSGD3D11Texture::fromNative(qtTexture, win, size(), texOpts); |