summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-05-21 09:06:30 +0200
committerJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-05-21 09:09:09 +0200
commit1aba2b28920229aa547470a6c3f3b443d7da6b3a (patch)
tree9e770dbc508a6445d4c4550297584aa0f3433668
parentfb7aa15c2a27a9dc841806d07aee9c39aa3fb2ef (diff)
Client: Don't crash when the cursor theme fails to loadv5.13.0-rc1
Fixes: QTBUG-75920 Change-Id: I29d84b487afb2a90b8a633abce2fcc39ca75adae Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
-rw-r--r--src/client/qwaylandinputdevice.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index 39c02d96..7f6f01cd 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -272,6 +272,10 @@ void QWaylandInputDevice::Pointer::updateCursorTheme()
int pixelSize = cursorSize() * scale;
auto *display = seat()->mQDisplay;
mCursor.theme = display->loadCursorTheme(cursorThemeName(), pixelSize);
+
+ if (!mCursor.theme)
+ return; // A warning has already been printed in loadCursorTheme
+
if (auto *arrow = mCursor.theme->cursorImage(Qt::ArrowCursor)) {
int arrowPixelSize = qMax(arrow->width, arrow->height); // Not all cursor themes are square
while (scale > 1 && arrowPixelSize / scale < cursorSize())
@@ -310,6 +314,9 @@ void QWaylandInputDevice::Pointer::updateCursor()
if (!mCursor.theme || idealCursorScale() != mCursor.themeBufferScale)
updateCursorTheme();
+ if (!mCursor.theme)
+ return;
+
// Set from shape using theme
if (struct ::wl_cursor_image *image = mCursor.theme->cursorImage(shape)) {
struct wl_buffer *buffer = wl_cursor_image_get_buffer(image);