]> git.sesse.net Git - kdenlive/commitdiff
Fix crash on thumb generation:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 3 Apr 2010 20:03:19 +0000 (20:03 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 3 Apr 2010 20:03:19 +0000 (20:03 +0000)
http://www.kdenlive.org/mantis/view.php?id=1542

svn path=/trunk/kdenlive/; revision=4367

src/docclipbase.cpp
src/docclipbase.h
src/kthumb.cpp
src/mainwindow.cpp
src/projectlist.cpp

index 9da1405f50da0193d4609d98a21c61a452efc9ec..90bc8d146f0be54cc795d5821bb514fa7d01076e 100644 (file)
@@ -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: "<<m_baseTrackProducers.count();
     int max = m_baseTrackProducers.count();
     for (int i = 0; i < max; i++) {
@@ -462,10 +462,11 @@ void DocClipBase::setValid()
 void DocClipBase::setProducer(Mlt::Producer *producer, bool reset)
 {
     if (producer == NULL || m_placeHolder) return;
+    if (m_thumbProd && (reset || !m_thumbProd->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)
index 5c025339ff4d696cf764f1ea090f1fbb7b9f4179..620fc70611b9c94b4862590620f60ffacf04427d 100644 (file)
@@ -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);
index 358e4223b13bee57001a185356221e2711048cc0..64ce5393a28740979cf9d822aa80c8d847cb384c 100644 (file)
@@ -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()
index 84a74679bf9758b9cf77adef707b036920e96b52..6c7a5e7d5ad36217b9dc76be2537b528d226a3e9 100644 (file)
@@ -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;
index 2c33398a9aaec6ef929a3705d25b86589a0c31bd..e389edcbe115f97c825246122d60cf5fa2aa8bf2 100644 (file)
@@ -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()));
 }