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>
This commit is contained in:
parent
351e3672d6
commit
a92c4a48bc
@ -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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user