xcb: Don't crash on missing mouse pointer
The draganddrop examples all crashed here because they were using a default-constructed QImage() (i.e. one without any content). I guess this happens here because I don't have any mouse theme set. To test, one could start a second X server, but without any WM or DE. The "evil" QImage() came from QGuiApplicationPrivate::getPixmapCursor(). This function seems to just always "return QPixmap();". This fix is correct because the only caller has another fallback if the createNonStandardCursor()-fallback didn't work. This caller is QXcbCursor::createFontCursor(). Change-Id: I7ec7fbcfdf0203e983149b5e73016cc7e85ecf40 Signed-off-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>bb10
parent
27df9a5a97
commit
04a4b99902
|
|
@ -426,10 +426,12 @@ xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape)
|
|||
} else if (cshape == Qt::DragCopyCursor || cshape == Qt::DragMoveCursor
|
||||
|| cshape == Qt::DragLinkCursor) {
|
||||
QImage image = QGuiApplicationPrivate::instance()->getPixmapCursor(static_cast<Qt::CursorShape>(cshape)).toImage();
|
||||
xcb_pixmap_t pm = qt_xcb_XPixmapFromBitmap(m_screen, image);
|
||||
xcb_pixmap_t pmm = qt_xcb_XPixmapFromBitmap(m_screen, image.createAlphaMask());
|
||||
cursor = xcb_generate_id(conn);
|
||||
xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8);
|
||||
if (!image.isNull()) {
|
||||
xcb_pixmap_t pm = qt_xcb_XPixmapFromBitmap(m_screen, image);
|
||||
xcb_pixmap_t pmm = qt_xcb_XPixmapFromBitmap(m_screen, image.createAlphaMask());
|
||||
cursor = xcb_generate_id(conn);
|
||||
xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8);
|
||||
}
|
||||
}
|
||||
|
||||
return cursor;
|
||||
|
|
|
|||
Loading…
Reference in New Issue