Fix crash & corruption on dragging multiple clips in timeline, fix thread...

Fix crash & corruption on dragging multiple clips in timeline, fix thread warning on monitor refresh
parent 463e9f84
......@@ -864,7 +864,6 @@ void Bin::slotDeleteClip()
if (!isChild) {
if (!usedClips && current->refCount() > 0) {
usedClips = true;
}
clipIds << current->clipId();
}
......@@ -910,7 +909,7 @@ void Bin::slotReloadClip()
}
}
}
}
}
QDomDocument doc;
QDomElement xml = currentItem->toXml(doc);
qDebug()<<"*****************\n"<<doc.toString()<<"\n******************";
......@@ -1951,7 +1950,9 @@ void Bin::slotProducerReady(requestClipInfo info, ClipController *controller)
m_doc->slotProxyCurrentItem(true, QList <ProjectClip *>() << clip);
}
}
} else emit producerReady(info.clipId);
} else {
emit producerReady(info.clipId);
}
QString currentClip = m_monitor->activeClipId();
if (currentClip.isEmpty()) {
//No clip displayed in monitor, check if item is selected
......
......@@ -165,6 +165,7 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
qRegisterMetaType<stringMap> ("stringMap");
qRegisterMetaType<audioByteArray> ("audioByteArray");
qRegisterMetaType< QVector <int> > ();
qRegisterMetaType< QList<ItemInfo> > ("QList<ItemInfo>");
qRegisterMetaType<QDomElement> ("QDomElement");
qRegisterMetaType<requestClipInfo> ("requestClipInfo");
qRegisterMetaType<MltVideoProfile> ("MltVideoProfile");
......
......@@ -21,6 +21,7 @@
#include "bincontroller.h"
#include "clipcontroller.h"
#include "kdenlivesettings.h"
#include "timeline/clip.h"
#include <QFileInfo>
......@@ -341,12 +342,8 @@ bool BinController::removeBinClip(const QString &id)
Mlt::Producer *BinController::cloneProducer(Mlt::Producer &original)
{
QString service = QString::fromLatin1(original.get("mlt_service"));
QString resource = QString::fromLatin1(original.get("resource"));
Mlt::Producer *clone = new Mlt::Producer(*original.profile(), service.toUtf8().constData(), resource.toUtf8().constData());
Mlt::Properties original_props(original.get_properties());
Mlt::Properties cloneProps(clone->get_properties());
cloneProps.inherit(original_props);
Clip clp(original);
Mlt::Producer *clone = clp.clone();
return clone;
}
......
......@@ -23,7 +23,8 @@
#include "clip.h"
#include <mlt++/Mlt.h>
#include <QDomDocument>
#include <QDebug>
Clip::Clip(Mlt::Producer &producer) : QObject(),
m_producer(producer)
......@@ -162,8 +163,9 @@ const QByteArray Clip::xml()
Mlt::Consumer c(*m_producer.profile(), "xml", "string");
Mlt::Service s(m_producer.get_service());
int ignore = s.get_int("ignore_points");
if (ignore) s.set("ignore_points", 0);
if (s.get_int("ignore_points")) s.set("ignore_points", 0);
if (ignore) {
s.set("ignore_points", 0);
}
c.connect(s);
c.set("time_format", "frames");
c.set("no_meta", 1);
......@@ -177,12 +179,17 @@ const QByteArray Clip::xml()
Mlt::Producer *Clip::clone()
{
QString service = QString::fromLatin1(m_producer.get("mlt_service"));
QString resource = QString::fromLatin1(m_producer.get("resource"));
Mlt::Producer *clone = new Mlt::Producer(*m_producer.profile(), service.toUtf8().constData(), resource.toUtf8().constData());
Mlt::Properties original(m_producer.get_properties());
Mlt::Properties cloneProps(clone->get_properties());
cloneProps.inherit(original);
QByteArray prodXml = xml();
//HACK: currently the MLT xml producer, when parsing a <profile>, does change the global profile accordingly.
// causing crash on threaded calls. To avoid this, we discard the profile info from our xml
QDomDocument doc;
doc.setContent(prodXml, true);
QDomNodeList profiles = doc.documentElement().elementsByTagName("profile");
if (!profiles.isEmpty()) {
QDomNode profile = profiles.item(0);
doc.documentElement().removeChild(profile);
}
Mlt::Producer *clone = new Mlt::Producer(*m_producer.profile(), "xml-string", doc.toByteArray().constData());
return clone;
}
......
......@@ -7210,8 +7210,9 @@ void CustomTrackView::monitorRefresh(QList <ItemInfo> range, bool invalidateRang
if (invalidateRange)
m_timeline->invalidateRange(range.at(i));
}
if (refreshMonitor)
if (refreshMonitor) {
m_document->renderer()->doRefresh();
}
}
void CustomTrackView::monitorRefresh(ItemInfo range, bool invalidateRange)
......@@ -7938,8 +7939,9 @@ void CustomTrackView::slotReplaceTimelineProducer(const QString &id)
Mlt::Producer *sprod = i.value();
m_document->renderer()->storeSlowmotionProducer(i.key() + url, sprod, true);
}
if (!toUpdate.isEmpty())
monitorRefresh(toUpdate, true);
if (!toUpdate.isEmpty()) {
QMetaObject::invokeMethod(this, "monitorRefresh", Qt::QueuedConnection, Q_ARG(QList <ItemInfo>, toUpdate), Q_ARG(bool, true));
}
m_timeline->refreshTractor();
}
......
......@@ -216,8 +216,6 @@ public:
/** @brief Returns last requested seeking pos, or current cursor position. */
int seekPosition() const;
/** @brief Trigger a monitor refresh. */
void monitorRefresh(QList <ItemInfo> range, bool invalidateRange = false);
void monitorRefresh(bool invalidateRange = false);
/** @brief Trigger a monitor refresh if timeline cursor is inside range. */
void monitorRefresh(ItemInfo range, bool invalidateRange = false);
......@@ -350,6 +348,8 @@ public slots:
void slotTransitionUpdated(Transition *, QDomElement);
void slotSwitchTrackLock(int ix, bool enable, bool applyToAll = false);
void slotUpdateClip(const QString &clipId, bool reload = true);
/** @brief Trigger a monitor refresh. */
void monitorRefresh(QList <ItemInfo> range, bool invalidateRange = false);
bool addGuide(const GenTime &pos, const QString &comment, bool loadingProject = false);
......
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