Fix crash on playlists concurrent jobs using library clips

CCBUG: 386616
parent 52bf3012
......@@ -104,7 +104,9 @@ ProjectClip::~ProjectClip()
// controller is deleted in bincontroller
abortAudioThumbs();
bin()->slotAbortAudioThumb(m_id, duration().ms());
QMutexLocker audioLock(&m_audioMutex);
if (m_controller) {
QMutexLocker locker(&m_controller->producerMutex);
}
m_thumbMutex.lock();
m_requestedThumbs.clear();
m_thumbMutex.unlock();
......@@ -399,13 +401,13 @@ Mlt::Producer *ProjectClip::originalProducer()
Mlt::Producer *ProjectClip::thumbProducer()
{
QMutexLocker locker(&m_producerMutex);
if (m_thumbsProducer) {
return m_thumbsProducer;
}
if (!m_controller || m_controller->clipType() == Unknown) {
return nullptr;
}
QMutexLocker locker(&m_controller->producerMutex);
Mlt::Producer prod = m_controller->originalProducer();
if (!prod.is_valid()) {
return nullptr;
......@@ -1023,7 +1025,10 @@ const QString ProjectClip::getAudioThumbPath(AudioStreamInfo *audioInfo)
void ProjectClip::slotCreateAudioThumbs()
{
QMutexLocker lock(&m_audioMutex);
if (!m_controller) {
return;
}
QMutexLocker locker(&m_controller->producerMutex);
Mlt::Producer *prod = originalProducer();
if (!prod || !prod->is_valid()) {
return;
......
......@@ -241,7 +241,6 @@ private:
QMutex m_producerMutex;
QMutex m_thumbMutex;
QMutex m_intraThumbMutex;
QMutex m_audioMutex;
QFuture <void> m_thumbThread;
QList<int> m_requestedThumbs;
QFuture <void> m_intraThread;
......
......@@ -251,7 +251,7 @@ void ClipController::updateProducer(const QString &id, Mlt::Producer *producer)
{
//TODO replace all track producers
Q_UNUSED(id)
QMutexLocker locker(&producerMutex);
Mlt::Properties passProperties;
// Keep track of necessary properties
QString proxy = producer->get("kdenlive:proxy");
......
......@@ -60,6 +60,8 @@ public:
explicit ClipController(BinController *bincontroller);
virtual ~ClipController();
QMutex producerMutex;
/** @brief Returns true if the master producer is valid */
bool isValid();
......
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