]> git.sesse.net Git - kdenlive/blobdiff - src/docclipbase.cpp
Various fixes to improve general stability in Qt 4.5.2
[kdenlive] / src / docclipbase.cpp
index 6c3addf01ce4798a3715347fadf49a5673b5d4d4..b1d5d1c9efbbdca29bcfefdafe74967a4d9db7d4 100644 (file)
@@ -408,15 +408,34 @@ QString DocClipBase::markerComment(GenTime t)
     return QString();
 }
 
+void DocClipBase::clearProducers()
+{
+    m_baseTrackProducers.clear();
+}
+
 void DocClipBase::deleteProducers()
 {
+    kDebug() << "// CLIP KILL PRODS ct: " << m_baseTrackProducers.count();
+    if (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++) {
+        kDebug()<<"// CLIP KILL PROD "<<i;
+    Mlt::Producer *p = m_baseTrackProducers.takeAt(i);
+    if (p != NULL) {
+     delete p;
+     p = NULL;
+    }
+    m_baseTrackProducers.insert(i, NULL);
+    }*/
+
+    delete m_videoOnlyProducer;
+    m_videoOnlyProducer = NULL;
+
     qDeleteAll(m_baseTrackProducers);
     m_baseTrackProducers.clear();
-    if (m_thumbProd) m_thumbProd->clearProducer();
     qDeleteAll(m_audioTrackProducers);
     m_audioTrackProducers.clear();
-    delete m_videoOnlyProducer;
-    m_videoOnlyProducer = NULL;
 }
 
 void DocClipBase::setProducer(Mlt::Producer *producer, bool reset)
@@ -424,9 +443,11 @@ void DocClipBase::setProducer(Mlt::Producer *producer, bool reset)
     if (producer == NULL) return;
     if (reset) {
         // Clear all previous producers
+        kDebug() << "/+++++++++++++++   DELETE ALL PRODS " << producer->get("id");
         deleteProducers();
     }
     QString id = producer->get("id");
+    kDebug() << "// set prod: " << id;
     if (id.contains('_')) {
         // this is a subtrack producer, insert it at correct place
         id = id.section('_', 1);
@@ -439,8 +460,7 @@ void DocClipBase::setProducer(Mlt::Producer *producer, bool reset)
             }
             if (m_audioTrackProducers.at(pos) == NULL) m_audioTrackProducers[pos] = producer;
             return;
-        }
-        if (id.endsWith("video")) {
+        } else if (id.endsWith("video")) {
             m_videoOnlyProducer = producer;
             return;
         }