Commit 5bbd0e6e authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Don't create task until we are sure we want it

parent f66d9b7c
......@@ -39,13 +39,12 @@ AudioLevelsTask::AudioLevelsTask(const ObjectId &owner, QObject* object)
void AudioLevelsTask::start(const ObjectId &owner, QObject* object, bool force)
{
AudioLevelsTask* task = new AudioLevelsTask(owner, object);
// See if there is already a task for this MLT service and resource.
if (pCore->taskManager.hasPendingJob(owner, AbstractTask::AUDIOTHUMBJOB)) {
qDebug()<<"AUDIO LEVELS TASK STARTED TWICE!!!!";
delete task;
task = nullptr;
return;
}
AudioLevelsTask* task = new AudioLevelsTask(owner, object);
if (task) {
// Otherwise, start a new audio levels generation thread.
task->m_isForce = force;
......
......@@ -39,11 +39,10 @@ CacheTask::~CacheTask()
void CacheTask::start(const ObjectId &owner, int thumbsCount, int in, int out, QObject* object, bool force)
{
CacheTask* task = new CacheTask(owner, thumbsCount, in, out, object);
if (pCore->taskManager.hasPendingJob(owner, AbstractTask::CACHEJOB)) {
delete task;
task = nullptr;
return;
}
CacheTask* task = new CacheTask(owner, thumbsCount, in, out, object);
if (task) {
// Otherwise, start a new audio levels generation thread.
task->m_isForce = force;
......
......@@ -30,12 +30,11 @@ ProxyTask::ProxyTask(const ObjectId &owner, QObject* object)
void ProxyTask::start(const ObjectId &owner, QObject* object, bool force)
{
ProxyTask* task = new ProxyTask(owner, object);
// See if there is already a task for this MLT service and resource.
if (pCore->taskManager.hasPendingJob(owner, AbstractTask::PROXYJOB)) {
delete task;
task = nullptr;
return;
}
ProxyTask* task = new ProxyTask(owner, object);
if (task) {
// Otherwise, start a new proxy generation thread.
task->m_isForce = force;
......
......@@ -40,12 +40,11 @@ TranscodeTask::TranscodeTask(const ObjectId &owner, const QString &suffix, const
void TranscodeTask::start(const ObjectId &owner, const QString &suffix, const QString &preParams, const QString &params, int in, int out, bool replaceProducer, QObject* object, bool force, bool checkProfile)
{
TranscodeTask* task = new TranscodeTask(owner, suffix, preParams, params, in, out, replaceProducer, object, checkProfile);
// See if there is already a task for this MLT service and resource.
if (pCore->taskManager.hasPendingJob(owner, AbstractTask::TRANSCODEJOB)) {
delete task;
task = 0;
return;
}
TranscodeTask* task = new TranscodeTask(owner, suffix, preParams, params, in, out, replaceProducer, object, checkProfile);
if (task) {
// Otherwise, start a new audio levels generation thread.
task->m_isForce = force;
......
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