Commit 89e885c3 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix crash on undo clip deletion.

Fixes #640
parent 2dff5c2f
......@@ -200,21 +200,24 @@ void EffectStackView::setModel(std::shared_ptr<EffectStackModel> model, const QS
loadEffects();
m_scrollTimer.start();
connect(m_model.get(), &EffectStackModel::dataChanged, this, &EffectStackView::refresh);
connect(m_model.get(), &EffectStackModel::enabledStateChanged, [this]() {
int max = m_model->rowCount();
int currentActive = m_model->getActiveEffect();
if (currentActive < max && currentActive > -1) {
auto item = m_model->getEffectStackRow(currentActive);
QModelIndex ix = m_model->getIndexFromItem(item);
CollapsibleEffectView *w = static_cast<CollapsibleEffectView *>(m_effectsTree->indexWidget(ix));
w->updateScene();
}
emit updateEnabledState();
});
connect(m_model.get(), &EffectStackModel::enabledStateChanged, this, &EffectStackView::changeEnabledState);
connect(this, &EffectStackView::removeCurrentEffect, m_model.get(), &EffectStackModel::removeCurrentEffect);
// m_builtStack->setModel(model, stackOwner());
}
void EffectStackView::changeEnabledState()
{
int max = m_model->rowCount();
int currentActive = m_model->getActiveEffect();
if (currentActive < max && currentActive > -1) {
auto item = m_model->getEffectStackRow(currentActive);
QModelIndex ix = m_model->getIndexFromItem(item);
CollapsibleEffectView *w = static_cast<CollapsibleEffectView *>(m_effectsTree->indexWidget(ix));
w->updateScene();
}
emit updateEnabledState();
}
void EffectStackView::loadEffects()
{
//QMutexLocker lock(&m_mutex);
......@@ -372,6 +375,7 @@ void EffectStackView::unsetModel(bool reset)
ObjectId item = m_model->getOwnerId();
id = item.first == ObjectType::BinClip ? Kdenlive::ClipMonitor : Kdenlive::ProjectMonitor;
disconnect(m_model.get(), &EffectStackModel::dataChanged, this, &EffectStackView::refresh);
disconnect(m_model.get(), &EffectStackModel::enabledStateChanged, this, &EffectStackView::changeEnabledState);
disconnect(this, &EffectStackView::removeCurrentEffect, m_model.get(), &EffectStackModel::removeCurrentEffect);
}
if (reset) {
......
......@@ -108,6 +108,9 @@ private slots:
/** @brief Save current effect stack
*/
void slotSaveStack();
/** @brief Refresh the enabled state on widgets
*/
void changeEnabledState();
// void switchBuiltStack(bool show);
......
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