Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Fix crash on document opening

parent 1fa1b9f0
......@@ -89,7 +89,7 @@ std::shared_ptr<ProjectClip> ProjectClip::construct(const QString &id, const QIc
baseFinishConstruct(self);
model->loadSubClips(id, self->getPropertiesFromPrefix(QStringLiteral("kdenlive:clipzone.")));
self->createAudioThumbs();
pCore->binController()->addClipToBin(id, self);
pCore->binController()->addClipToBin(id, self, true);
return self;
}
......
......@@ -277,14 +277,16 @@ void BinController::replaceProducer(const requestClipInfo &info, const std::shar
emit prepareTimelineReplacement(info);
}
void BinController::addClipToBin(const QString &id, const std::shared_ptr<ClipController> &controller)
void BinController::addClipToBin(const QString &id, const std::shared_ptr<ClipController> &controller, bool fromPlaylist)
{
/** Test: we can use filters on clips in the bin this way
Mlt::Filter f(*m_mltProfile, "sepia");
producer.attach(f);
*/
// append or replace clip in MLT's retain playlist
replaceBinPlaylistClip(id, controller->originalProducer());
if (!fromPlaylist) {
replaceBinPlaylistClip(id, controller->originalProducer());
}
if (!m_clipList.contains(id)) {
m_clipList.insert(id, controller);
}
......
......@@ -66,7 +66,7 @@ protected:
* @param id The clip's id
* @param producer The MLT producer for this clip
* */
void addClipToBin(const QString &id, const std::shared_ptr<ClipController> &controller);
void addClipToBin(const QString &id, const std::shared_ptr<ClipController> &controller, bool fromPlaylist = false);
public:
/** @brief Store a timeline producer in clip list for later re-use
......
......@@ -115,20 +115,21 @@ AudioStreamInfo *ClipController::audioInfo() const
void ClipController::addMasterProducer(const std::shared_ptr<Mlt::Producer> &producer)
{
QString documentRoot;
m_masterProducer = producer;
m_producerLock.unlock();
if (auto ptr = m_binController.lock()) {
documentRoot = ptr->documentRoot();
// insert controller in bin
ptr->addClipToBin(clipId(), static_cast<std::shared_ptr<ClipController>>(this));
} else {
qDebug() << "Error: impossible to add master producer because bincontroller is not available";
}
m_masterProducer = producer;
m_properties = new Mlt::Properties(m_masterProducer->get_properties());
m_effectStack = EffectStackModel::construct(producer, {ObjectType::BinClip, m_properties->get_int("kdenlive:id")}, pCore->undoStack());
if (!m_masterProducer->is_valid()) {
m_masterProducer = ClipController::mediaUnavailable;
m_producerLock.unlock();
qCDebug(KDENLIVE_LOG) << "// WARNING, USING INVALID PRODUCER";
} else {
m_producerLock.unlock();
QString proxy = m_properties->get("kdenlive:proxy");
m_service = m_properties->get("mlt_service");
QString path = m_properties->get("resource");
......@@ -144,10 +145,6 @@ void ClipController::addMasterProducer(const std::shared_ptr<Mlt::Producer> &pro
path.prepend(documentRoot);
}
m_path = QFileInfo(path).absoluteFilePath();
// insert controller in bin
if (auto ptr = m_binController.lock()) {
ptr->addClipToBin(clipId(), static_cast<std::shared_ptr<ClipController>>(this));
}
getInfoForProducer();
}
}
......
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