diff options
author | Joni Poikelin <joni.poikelin@qt.io> | 2019-02-28 09:54:20 +0200 |
---|---|---|
committer | Joni Poikelin <joni.poikelin@qt.io> | 2019-06-28 12:37:16 +0200 |
commit | d1141b6c90e53554f69fd6a7a272988211f5bd34 (patch) | |
tree | 76e62f50ab6b8d4c3f74c4ab7ab2ed9e299683fb | |
parent | 1e4dec12d5c0152d5c3eee3b612a0af4bf389a37 (diff) |
Fix crash with drag cursor handling
7a7c722782a435f7c01b94f48df7a5f4ff4d599e caused a regresssion in some
cases.
Change-Id: I1089a79534d811b195de663ff664d9ba5a6ac6c5
Fixes: QTBUG-74110
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r-- | src/gui/kernel/qsimpledrag.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index 9aab332ef5..bd409c124f 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -310,11 +310,15 @@ void QBasicDrag::updateCursor(Qt::DropAction action) m_dndHasSetOverrideCursor = true; } else { QCursor *cursor = QGuiApplication::overrideCursor(); - if (!pixmap.isNull()) { - if (cursor->pixmap().cacheKey() != pixmap.cacheKey()) - QGuiApplication::changeOverrideCursor(QCursor(pixmap)); - } else if (cursorShape != cursor->shape()) { - QGuiApplication::changeOverrideCursor(QCursor(cursorShape)); + if (!cursor) { + QGuiApplication::changeOverrideCursor(pixmap.isNull() ? QCursor(cursorShape) : QCursor(pixmap)); + } else { + if (!pixmap.isNull()) { + if (cursor->pixmap().cacheKey() != pixmap.cacheKey()) + QGuiApplication::changeOverrideCursor(QCursor(pixmap)); + } else if (cursorShape != cursor->shape()) { + QGuiApplication::changeOverrideCursor(QCursor(cursorShape)); + } } } #endif |