From c6d91a42008369b47b31bffb5cf8673d3232198b Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Sat, 3 Apr 2010 20:03:19 +0000 Subject: [PATCH] Fix crash on thumb generation: http://www.kdenlive.org/mantis/view.php?id=1542 svn path=/trunk/kdenlive/; revision=4367 --- src/docclipbase.cpp | 8 ++++---- src/docclipbase.h | 2 +- src/kthumb.cpp | 2 ++ src/mainwindow.cpp | 2 +- src/projectlist.cpp | 7 ++++--- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/docclipbase.cpp b/src/docclipbase.cpp index 9da1405f..90bc8d14 100644 --- a/src/docclipbase.cpp +++ b/src/docclipbase.cpp @@ -429,10 +429,10 @@ void DocClipBase::clearProducers() m_baseTrackProducers.clear(); } -void DocClipBase::deleteProducers() +void DocClipBase::deleteProducers(bool clearThumbCreator) { kDebug() << "// CLIP KILL PRODS ct: " << m_baseTrackProducers.count(); - if (m_thumbProd) m_thumbProd->clearProducer(); + if (clearThumbCreator && m_thumbProd) m_thumbProd->clearProducer(); /*kDebug()<<"// CLIP KILL PRODS ct: "<hasProducer())) m_thumbProd->setProducer(producer); if (reset) { // Clear all previous producers kDebug() << "/+++++++++++++++ DELETE ALL PRODS " << producer->get("id"); - deleteProducers(); + deleteProducers(false); } QString id = producer->get("id"); if (id.contains('_')) { @@ -497,7 +498,6 @@ void DocClipBase::setProducer(Mlt::Producer *producer, bool reset) } //m_clipProducer = producer; //m_clipProducer->set("transparency", m_properties.value("transparency").toInt()); - if (m_thumbProd && (reset || !m_thumbProd->hasProducer())) m_thumbProd->setProducer(producer); } Mlt::Producer *DocClipBase::audioProducer(int track) diff --git a/src/docclipbase.h b/src/docclipbase.h index 5c025339..620fc706 100644 --- a/src/docclipbase.h +++ b/src/docclipbase.h @@ -180,7 +180,7 @@ Q_OBJECT public: void setProducerProperty(const char *name, const char *data); void resetProducerProperty(const char *name); void clearProducers(); - void deleteProducers(); + void deleteProducers(bool clearThumbCreator = true); /** Set default play zone for clip monitor */ void setZone(QPoint zone); diff --git a/src/kthumb.cpp b/src/kthumb.cpp index 358e4223..64ce5393 100644 --- a/src/kthumb.cpp +++ b/src/kthumb.cpp @@ -145,6 +145,8 @@ KThumb::~KThumb() void KThumb::setProducer(Mlt::Producer *producer) { + m_requestedThumbs.clear(); + m_future.waitForFinished(); m_producer = producer; // FIXME: the profile() call leaks an object, but trying to free // it leads to a double-free in Profile::~Profile() diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 84a74679..6c7a5e7d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2603,7 +2603,7 @@ void MainWindow::slotShowClipProperties(DocClipBase *clip) } EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true); m_activeDocument->commandStack()->push(command); - m_activeTimeline->projectView()->slotUpdateClip(clip->getId()); + //m_activeTimeline->projectView()->slotUpdateClip(clip->getId()); m_activeDocument->setModified(true); } delete dia_ui; diff --git a/src/projectlist.cpp b/src/projectlist.cpp index 2c33398a..e389edcb 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -1243,6 +1243,8 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce // update clip in clip monitor emit clipSelected(NULL); emit clipSelected(item->referencedClip()); + //TODO: Make sure the line below has no side effect + toReload = clipId; } /*else { // Check if duration changed. @@ -1255,13 +1257,12 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce }*/ } else kDebug() << "//////// COULD NOT FIND CLIP TO UPDATE PRPS..."; int max = m_doc->clipManager()->clipsCount(); - emit displayMessage(i18n("Loading clips"), (int)(100 *(max - m_infoQueue.count()) / max)); - // small delay so that the app can display the progress info if (item && m_infoQueue.isEmpty() && m_thumbnailQueue.isEmpty()) { m_listView->setCurrentItem(item); emit clipSelected(item->referencedClip()); - } + } else emit displayMessage(i18n("Loading clips"), (int)(100 *(max - m_infoQueue.count()) / max)); if (!toReload.isEmpty()) emit clipNeedsReload(toReload, true); + // small delay so that the app can display the progress info QTimer::singleShot(30, this, SLOT(slotProcessNextClipInQueue())); } -- 2.39.2