Fix crash trying to move timeline clip to another track when bin clip had some effects

parent 27072ed4
......@@ -827,10 +827,16 @@ const QVector<QPair<QString, QVariant>> AssetParameterModel::loadPreset(const QS
return params;
}
void AssetParameterModel::setParameters(const QVector<QPair<QString, QVariant>> &params)
void AssetParameterModel::setParameters(const QVector<QPair<QString, QVariant>> &params, bool update)
{
QLocale locale;
locale.setNumberOptions(QLocale::OmitGroupSeparator);
ObjectType itemId;
if (!update) {
// Change itemId to NoItem to ensure we don't send any update like refreshProjectItem that would trigger monitor refreshes.
itemId = m_ownerId.first;
m_ownerId.first = ObjectType::NoItem;
}
for (const auto &param : params) {
if (param.second.type() == QVariant::Double) {
setParameter(param.first, locale.toString(param.second.toDouble()), false);
......@@ -841,6 +847,9 @@ void AssetParameterModel::setParameters(const QVector<QPair<QString, QVariant>>
if (m_keyframes) {
m_keyframes->refresh();
}
if (!update) {
m_ownerId.first = itemId;
}
emit dataChanged(index(0), index(m_rows.count()), {});
}
......
......@@ -145,7 +145,7 @@ public:
/* @brief Sets the value of a list of parameters
@param params contains the pairs (parameter name, parameter value)
*/
void setParameters(const QVector<QPair<QString, QVariant>> &params);
void setParameters(const QVector<QPair<QString, QVariant>> &params, bool update = true);
/* Which monitor is attached to this asset (clip/project)
*/
......
......@@ -134,7 +134,7 @@ void EffectItemModel::plantClone(const std::weak_ptr<Mlt::Service> &service)
std::shared_ptr<EffectItemModel> effect = nullptr;
if (auto ptr2 = m_model.lock()) {
effect = EffectItemModel::construct(effectId, ptr2);
effect->setParameters(getAllParameters());
effect->setParameters(getAllParameters(), false);
int childId = ptr->get_int("_childid");
if (childId == 0) {
childId = m_childId++;
......
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