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
Pick-to: 6.5 6.6
Change-Id: Ifa9110945e191c4ffebe099e3e4edf9c571ab376
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-06-05 17:19:44 +02:00
parent b006d6d9de
commit f1011bd2ed

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();
}
}