Prevent crash and emit warning when receiving bogus drop events.

Task-number: QTBUG-33635

Change-Id: I6d436bc4d47d1d6b063fc2cf27d67fe4684e7491
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Friedemann Kleint 2014-01-31 13:22:24 +01:00 committed by The Qt Project
parent 4dcb607aa9
commit 65b26acb7c

View File

@ -659,6 +659,11 @@ void QWidgetWindow::handleDragLeaveEvent(QDragLeaveEvent *event)
void QWidgetWindow::handleDropEvent(QDropEvent *event)
{
if (m_dragTarget.isNull()) {
qWarning() << Q_FUNC_INFO << m_widget << ": No drag target set.";
event->ignore();
return;
}
const QPoint mapped = m_dragTarget.data()->mapFromGlobal(m_widget->mapToGlobal(event->pos()));
QDropEvent translated(mapped, event->possibleActions(), event->mimeData(), event->mouseButtons(), event->keyboardModifiers());
QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), &translated);