Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 77f1e675 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Folder View] Use a copy of QMimeData in signal handler

By the time we leave the method, the QMimeData is deleted by the DragArea's drop event being destroyed leading to a crash.

CHANGELOG: Fixed crash when dropping files on desktop with KDeclarative from KDE Frameworks 5.35

BUG: 380806
FIXED-IN: 5.10.1

Differential Revision:
parent 601ad407
......@@ -952,8 +952,16 @@ void FolderModel::drop(QQuickItem *target, QObject* dropEvent, int row)
const int x = dropEvent->property("x").toInt();
const int y = dropEvent->property("y").toInt();
connect(dropJob, static_cast<void(KIO::DropJob::*)(const KFileItemListProperties &)>(&KIO::DropJob::popupMenuAboutToShow), this, [this, mimeData, x, y, dropJob](const KFileItemListProperties &) {
emit popupMenuAboutToShow(dropJob, mimeData, x, y);
// The QMimeData we extract from the DropArea's drop event is deleted as soon as this method
// ends but we need to keep a copy for when popupMenuAboutToShow fires.
QMimeData *mimeCopy = new QMimeData();
for (const QString &format : mimeData->formats()) {
mimeCopy->setData(format, mimeData->data(format));
connect(dropJob, static_cast<void(KIO::DropJob::*)(const KFileItemListProperties &)>(&KIO::DropJob::popupMenuAboutToShow), this, [this, mimeCopy, x, y, dropJob](const KFileItemListProperties &) {
emit popupMenuAboutToShow(dropJob, mimeCopy, x, y);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment