Commit 3d37590f authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Project: Add some more checks in DND

Not sure what caused the crash in the linked bug, but adding another
check and capturing the variable outside doesn't hurt

BUG: 458398
parent e1b4bc5c
Pipeline #224480 passed with stage
in 6 minutes and 25 seconds
......@@ -59,11 +59,12 @@ bool KateProjectModel::dropMimeData(const QMimeData *data, Qt::DropAction action
}
const auto urls = data->urls();
const QUrl dest = QUrl::fromLocalFile(d.absolutePath());
const QString destDir = d.absolutePath();
const QUrl dest = QUrl::fromLocalFile(destDir);
QPointer<KIO::CopyJob> job = KIO::copy(urls, dest);
KJobWidgets::setWindow(job, QApplication::activeWindow());
connect(job, &KIO::Job::finished, this, [this, job, destDir = d.absolutePath()] {
if (!job || job->error() != 0)
connect(job, &KIO::Job::finished, this, [this, job, destDir] {
if (!job || job->error() != 0 || !m_project)
return;
bool needsReload = false;
......
......@@ -14,6 +14,7 @@
#include <KTextEditor/ModificationInterface>
#include <QHash>
#include <QPointer>
#include <QSharedPointer>
#include <QTextDocument>
......@@ -33,7 +34,7 @@ public:
private:
friend class KateProject;
class KateProject *m_project = nullptr;
QPointer<class KateProject> m_project;
};
/**
......
Supports Markdown
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