summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Blin <olivier.blin@softathome.com>2014-09-09 19:42:10 +0200
committerRobin Burchell <robin.burchell@viroteck.net>2014-10-21 18:42:02 +0200
commit3014d58a660ea976a9d2fb1561ade345be6959d8 (patch)
tree15a94043a9adc0e94cd19479363d73cea51e3fe9
parentc3d2a7bd8af4102441c113e088bd6a2cb50b97cf (diff)
downloadqtwayland-3014d58a660ea976a9d2fb1561ade345be6959d8.tar.gz
Fix crash when cursor theme can not be loaded
Also add a debug message about theme loading failure. This is not necessarily fatal, some embedded applications could still function properly without a cursor. Change-Id: Ib3e2ee43b00630ee77997c7472a95ac5a22c2cc2 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
-rw-r--r--src/client/qwaylandcursor.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client/qwaylandcursor.cpp b/src/client/qwaylandcursor.cpp
index 90789b0d..2a1339a7 100644
--- a/src/client/qwaylandcursor.cpp
+++ b/src/client/qwaylandcursor.cpp
@@ -66,12 +66,15 @@ QWaylandCursor::QWaylandCursor(QWaylandScreen *screen)
if (!hasCursorSize || cursorSize <= 0)
cursorSize = 32;
mCursorTheme = wl_cursor_theme_load(cursorTheme, cursorSize, mDisplay->shm());
+ if (!mCursorTheme)
+ qDebug() << "Could not load theme" << cursorTheme;
initCursorMap();
}
QWaylandCursor::~QWaylandCursor()
{
- wl_cursor_theme_destroy(mCursorTheme);
+ if (mCursorTheme)
+ wl_cursor_theme_destroy(mCursorTheme);
}
struct wl_cursor_image *QWaylandCursor::cursorImage(Qt::CursorShape newShape)
@@ -160,6 +163,9 @@ wl_cursor *QWaylandCursor::requestCursor(WaylandCursor shape)
//If the cursor has not been loaded already, load it
if (!cursor) {
+ if (!mCursorTheme)
+ return NULL;
+
QList<QByteArray> cursorNames = mCursorNamesMap.values(shape);
foreach (QByteArray name, cursorNames) {
cursor = wl_cursor_theme_get_cursor(mCursorTheme, name.constData());