From 115e39f9be99069dcb96579064e78b9a8f5468fc Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 28 Jan 2020 18:00:20 +0100 Subject: Avoid return QImage::Format_Invalid from QPlatformScreen::format() This can be used to set the pixmap format, and needs to be defined to something sane even if there is no primary screen. Task-number: QTBUG-81671 Change-Id: Ic0d41cec31ac71309123aa8bb8b840fa4a4122bb Reviewed-by: Eirik Aavitsland --- src/plugins/platforms/xcb/qxcbscreen.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index e937464c62..87e1c9bdf8 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -665,7 +665,9 @@ QImage::Format QXcbScreen::format() const bool needsRgbSwap; qt_xcb_imageFormatForVisual(connection(), screen()->root_depth, visualForId(screen()->root_visual), &format, &needsRgbSwap); // We are ignoring needsRgbSwap here and just assumes the backing-store will handle it. - return format; + if (format != QImage::Format_Invalid) + return format; + return QImage::Format_RGB32; } int QXcbScreen::forcedDpi() const -- cgit v1.2.3