macOS: Don't assume DnD is handled via internal drag loop

If we have only one item, we're not using beginDraggingSessionWithItems
which requires us to manage our own drag loop, and instead use good old
dragImage, which takes care of the drag loop on our behalf.

In both cases we end up in draggingSession:endedAtPoint, so we need
to explicitly check for the existence of a manually managed drag session.

Amends 8a359343621fa83941946cb4e661b54ca7a1c4cc.

Fixes: QTBUG-114236
Change-Id: Ifa9110945e191c4ffebe099e3e4edf9c571ab376
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f1011bd2ed3747880e08791fddbb63f73b0faffe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tor Arne Vestbø 2023-06-05 17:19:44 +02:00 committed by Qt Cherry-pick Bot
parent aae0cc0702
commit 18fead0d4f

View File

@ -226,9 +226,10 @@ void QCocoaDrag::setAcceptedAction(Qt::DropAction act)
void QCocoaDrag::exitDragLoop()
{
Q_ASSERT(m_internalDragLoop);
if (m_internalDragLoop->isRunning())
if (m_internalDragLoop) {
Q_ASSERT(m_internalDragLoop->isRunning());
m_internalDragLoop->exit();
}
}