Commit 769b551b authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix crash on fade deletion from timeline

parent 06879371
......@@ -200,17 +200,20 @@ void EffectStackView::setModel(std::shared_ptr<EffectStackModel> model, const QS
m_scrollTimer.start();
connect(m_model.get(), &EffectStackModel::dataChanged, this, &EffectStackView::refresh);
connect(m_model.get(), &EffectStackModel::enabledStateChanged, this, &EffectStackView::changeEnabledState);
connect(m_model.get(), &EffectStackModel::currentChanged, this, [=](QModelIndex ix, bool active) {
m_effectsTree->setCurrentIndex(ix);
auto *w = static_cast<CollapsibleEffectView *>(m_effectsTree->indexWidget(ix));
if (w) {
w->slotActivateEffect(active);
}
});
connect(m_model.get(), &EffectStackModel::currentChanged, this, &EffectStackView::activateEffect, Qt::DirectConnection);
connect(this, &EffectStackView::removeCurrentEffect, m_model.get(), &EffectStackModel::removeCurrentEffect);
// m_builtStack->setModel(model, stackOwner());
}
void EffectStackView::activateEffect(QModelIndex ix, bool active)
{
m_effectsTree->setCurrentIndex(ix);
auto *w = static_cast<CollapsibleEffectView *>(m_effectsTree->indexWidget(ix));
if (w) {
w->slotActivateEffect(active);
}
}
void EffectStackView::changeEnabledState()
{
int max = m_model->rowCount();
......@@ -405,6 +408,7 @@ void EffectStackView::unsetModel(bool reset)
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);
disconnect(m_model.get(), &EffectStackModel::currentChanged, this, &EffectStackView::activateEffect);
disconnect(&m_timerHeight, &QTimer::timeout, this, &EffectStackView::updateTreeHeight);
emit pCore->disconnectEffectStack();
}
......
......@@ -111,6 +111,9 @@ private slots:
/** @brief Refresh the enabled state on widgets
*/
void changeEnabledState();
/** @brief Activate an effect in the view
*/
void activateEffect(QModelIndex ix, bool active);
// 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