summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <jb@kdenlive.org>2016-09-15 16:59:35 (GMT)
committerJean-Baptiste Mardelle <jb@kdenlive.org>2016-09-15 16:59:35 (GMT)
commit6883a671792763da469dd08531378031b05f13da (patch)
tree5be3413a68abfc3eab99f0a49aa181931b99f3be
parenta0d1e3d57c2e2cabfd890a6c2d5c3b0887e70af6 (diff)
Fix deletion of source clip when using new speed clip job, add safeguard
BUG: 368836
-rw-r--r--src/project/jobs/filterjob.cpp14
-rw-r--r--src/project/jobs/meltjob.cpp12
2 files changed, 13 insertions, 13 deletions
diff --git a/src/project/jobs/filterjob.cpp b/src/project/jobs/filterjob.cpp
index ab9a201..9d7540d 100644
--- a/src/project/jobs/filterjob.cpp
+++ b/src/project/jobs/filterjob.cpp
@@ -90,7 +90,7 @@ QHash <ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(QList <ProjectCli
producerParams.insert(QStringLiteral("producer"), prodstring);
QString destination;
if (multipleSelection) {
- destination = destFolder.absoluteFilePath(QUrl::fromLocalFile(sources.at(i)).fileName());
+ destination = destFolder.absoluteFilePath(QUrl::fromLocalFile(sources.at(i)).fileName() + QStringLiteral(".mlt"));
} else {
destination = d->selectedUrl().path();
}
@@ -126,7 +126,7 @@ QHash <ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(QList <ProjectCli
QMap <QString, QString> producerParams = QMap <QString, QString> ();
QMap <QString, QString> filterParams = QMap <QString, QString> ();
QMap <QString, QString> consumerParams = QMap <QString, QString> ();
-
+
// Producer params
// None
@@ -135,7 +135,7 @@ QHash <ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(QList <ProjectCli
filterParams.insert(QStringLiteral("filter"), filterName);
filterParams.insert(QStringLiteral("shot_change_list"), QStringLiteral("0"));
filterParams.insert(QStringLiteral("denoise"), QStringLiteral("0"));
-
+
// Consumer
consumerParams.insert(QStringLiteral("consumer"), QStringLiteral("null"));
consumerParams.insert(QStringLiteral("all"), QStringLiteral("1"));
@@ -188,7 +188,7 @@ QHash <ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(QList <ProjectCli
producerParams.insert(QStringLiteral("in"), QString::number(in));
producerParams.insert(QStringLiteral("out"), QString::number(out));
producerParams.insert(QStringLiteral("producer"), sources.at(i));
-
+
// Destination
// Since this job is only doing analysis, we have a null consumer and no destination
MeltJob *job = new MeltJob(clip->clipType(), clip->clipId(), producerParams, filterParams, consumerParams, extraParams);
@@ -250,9 +250,3 @@ QHash <ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(QList <ProjectCli
}
return jobs;
}
-
-
-
-
-
-
diff --git a/src/project/jobs/meltjob.cpp b/src/project/jobs/meltjob.cpp
index f521b03..7ce3181 100644
--- a/src/project/jobs/meltjob.cpp
+++ b/src/project/jobs/meltjob.cpp
@@ -52,8 +52,9 @@ MeltJob::MeltJob(ClipType cType, const QString id, const QMap <QString, QString>
m_jobStatus = JobWaiting;
description = i18n("Processing clip");
QString consum = m_consumerParams.value(QStringLiteral("consumer"));
- if (consum.contains(QLatin1Char(':')))
+ if (consum.contains(QLatin1Char(':'))) {
m_dest = consum.section(QLatin1Char(':'), 1);
+ }
m_url = producerParams.value(QStringLiteral("producer"));
}
@@ -64,12 +65,17 @@ void MeltJob::startJob()
setStatus(JobCrashed);
return;
}
+ QString consumerName = m_consumerParams.value(QStringLiteral("consumer"));
+ // safety check, make sure we don't overwrite a source clip
+ if (!m_dest.isEmpty() && !m_dest.endsWith(QStringLiteral(".mlt"))) {
+ m_errorMessage.append(i18n("Invalid destination: %1.", consumerName));
+ setStatus(JobCrashed);
+ return;
+ }
int in = m_producerParams.value(QStringLiteral("in")).toInt();
if (in > 0 && !m_extra.contains(QStringLiteral("offset"))) m_extra.insert(QStringLiteral("offset"), QString::number(in));
int out = m_producerParams.value(QStringLiteral("out")).toInt();
QString filterName = m_filterParams.value(QStringLiteral("filter"));
- QString consumerName = m_consumerParams.value(QStringLiteral("consumer"));
- if (consumerName.contains(QLatin1Char(':'))) m_dest = consumerName.section(QLatin1Char(':'), 1);
// optional params
int startPos = -1;