Commit 0565e46c authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix crash on undo center keyframe

parent 4e1db7e6
......@@ -53,6 +53,15 @@ KeyframeView::KeyframeView(std::shared_ptr<KeyframeModelList> model, int duratio
setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
connect(m_model.get(), &KeyframeModelList::modelChanged, this, &KeyframeView::slotModelChanged);
connect(m_model.get(), &KeyframeModelList::modelDisplayChanged, this, &KeyframeView::slotModelDisplayChanged);
m_centerConnection = connect(this, &KeyframeView::updateKeyframeOriginal, this, [&](int pos) {
m_currentKeyframeOriginal = pos;
update();
});
}
KeyframeView::~KeyframeView()
{
QObject::disconnect( m_centerConnection );
}
void KeyframeView::slotModelChanged()
......@@ -268,13 +277,11 @@ void KeyframeView::slotCenterKeyframe()
break;
}
Fun local_redo = [this, position = m_position]() {
m_currentKeyframeOriginal = position;
update();
emit updateKeyframeOriginal(position);
return true;
};
Fun local_undo = [this, sourcePosition]() {
m_currentKeyframeOriginal = sourcePosition;
update();
emit updateKeyframeOriginal(sourcePosition);
return true;
};
local_redo();
......
......@@ -19,6 +19,7 @@ class KeyframeView : public QWidget
public:
explicit KeyframeView(std::shared_ptr<KeyframeModelList> model, int duration, QWidget *parent = nullptr);
~KeyframeView() override;
void setDuration(int duration);
const QString getAssetId();
/** @brief Copy a keyframe parameter to selected keyframes. */
......@@ -93,10 +94,12 @@ private:
QColor m_colSelected;
QColor m_colKeyframe;
QColor m_colKeyframeBg;
QMetaObject::Connection m_centerConnection;
signals:
void seekToPos(int pos);
void atKeyframe(bool isKeyframe, bool singleKeyframe);
void modified();
void activateEffect();
void updateKeyframeOriginal(int pos);
};
Supports Markdown
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