Fix crash on track deletion:

http://kdenlive.org/mantis/view.php?id=2168

svn path=/trunk/kdenlive/; revision=5714
parent 70dbe2ed
HEAD
* Fix crash when deleting a track and having an audio clip on last track (http://kdenlive.org/mantis/view.php?id=2168)
* Check for duration mismatch in clip producers when opening a document (can cause corruption)
* Automatically create backups of the project file; they can be restored in a recovery dialog.
* Allow to manually edit video4linux capture profile.
......
......@@ -2743,9 +2743,9 @@ void CustomTrackView::removeTrack(int ix)
clip->updateItem();
ItemInfo clipinfo = clip->info();
// We add a move clip command so that we get the correct producer for new track number
if (clip->clipType() == AV || clip->clipType() == AUDIO) {
if (clip->clipType() == AV || clip->clipType() == AUDIO || clip->clipType() == PLAYLIST) {
Mlt::Producer *prod = clip->getProducer(clipinfo.track);
if (!m_document->renderer()->mltUpdateClipProducer((int)(m_document->tracksCount() - clipinfo.track), clipinfo.startPos.frames(m_document->fps()), prod)) {
if (prod == NULL || !m_document->renderer()->mltUpdateClipProducer((int)(m_document->tracksCount() - clipinfo.track), clipinfo.startPos.frames(m_document->fps()), prod)) {
emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", clipinfo.startPos.frames(m_document->fps()), clipinfo.track), ErrorMessage);
}
}
......@@ -5309,7 +5309,7 @@ bool CustomTrackView::canBePastedTo(ItemInfo info, int type) const
// If we are in overwrite mode, always allow the move
return true;
}
int height;
int height = m_tracksHeight - 2;
int offset = 0;
if (type == TRANSITIONWIDGET) {
height = Transition::itemHeight();
......
......@@ -536,6 +536,14 @@ Mlt::Producer *DocClipBase::audioProducer(int track)
}
}
if (m_audioTrackProducers.at(track) == NULL) {
int i;
for (i = 0; i < m_audioTrackProducers.count(); i++)
if (m_audioTrackProducers.at(i) != NULL) break;
if (i < m_audioTrackProducers.count()) {
// Could not find a valid producer for that clip, check in
return m_audioTrackProducers.at(i);
}
Mlt::Producer *base = producer();
m_audioTrackProducers[track] = new Mlt::Producer(*(base->profile()), base->get("resource"));
if (m_properties.contains("force_aspect_num") && m_properties.contains("force_aspect_den") && m_properties.contains("frame_size"))
......@@ -581,7 +589,7 @@ Mlt::Producer *DocClipBase::producer(int track)
/*for (int i = 0; i < m_baseTrackProducers.count(); i++) {
if (m_baseTrackProducers.at(i)) kDebug() << "// PROD: " << i << ", ID: " << m_baseTrackProducers.at(i)->get("id");
}*/
if (track == -1 || (m_clipType != AUDIO && m_clipType != AV)) {
if (track == -1 || (m_clipType != AUDIO && m_clipType != AV && m_clipType != PLAYLIST)) {
if (m_baseTrackProducers.count() == 0) return NULL;
for (int i = 0; i < m_baseTrackProducers.count(); i++) {
if (m_baseTrackProducers.at(i) != NULL)
......@@ -599,7 +607,10 @@ Mlt::Producer *DocClipBase::producer(int track)
for (i = 0; i < m_baseTrackProducers.count(); i++)
if (m_baseTrackProducers.at(i) != NULL) break;
if (i >= m_baseTrackProducers.count()) return NULL;
if (i >= m_baseTrackProducers.count()) {
// Could not find a valid producer for that clip, check in
return NULL;
}
if (KIO::NetAccess::exists(KUrl(m_baseTrackProducers.at(i)->get("resource")), KIO::NetAccess::SourceSide, 0))
m_baseTrackProducers[track] = new Mlt::Producer(*m_baseTrackProducers.at(i)->profile(), m_baseTrackProducers.at(i)->get("resource"));
......
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