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

Fix possible crashes in timeremap

parent 511997cb
......@@ -1064,3 +1064,12 @@ MixAlignment Core::getMixAlign(int cid) const
{
return m_mainWindow->getCurrentTimeline()->controller()->getMixAlign(cid);
}
void Core::cleanup()
{
audioThumbCache.clear();
taskManager.slotCancelJobs();
timeRemapWidget()->selectedClip(-1);
disconnect(m_mainWindow->getMainTimeline()->controller(), &TimelineController::durationChanged, m_projectManager, &ProjectManager::adjustProjectDuration);
m_mainWindow->getMainTimeline()->controller()->clipActions.clear();
}
......@@ -259,6 +259,8 @@ public:
void resizeMix(int cid, int duration, MixAlignment align);
/** @brief Get alignment info for a mix item */
MixAlignment getMixAlign(int cid) const;
/** @brief Closing current document, do some cleanup */
void cleanup();
private:
explicit Core();
......
......@@ -46,6 +46,7 @@ RemapView::RemapView(QWidget *parent)
: QWidget(parent)
, m_duration(1)
, m_position(0)
, m_bottomPosition(0)
, m_scale(1.)
, m_zoomFactor(1)
, m_zoomStart(0)
......@@ -1412,11 +1413,15 @@ void RemapView::paintEvent(QPaintEvent *event)
if (m_bottomPosition >= 0 && m_bottomPosition < m_duration) {
p.setBrush(m_colSelected);
int topPos = GenTime(m_remapLink->anim_get_double("map", m_bottomPosition + m_inFrame)).frames(pCore->getCurrentFps()) - m_inFrame;
double scaledPos = topPos * m_scale;
scaledPos -= m_zoomStart;
scaledPos *= m_zoomFactor;
scaledPos += m_offset;
int topPos = -1;
double scaledPos = -1;
if (m_remapLink && !m_keyframes.isEmpty()) {
topPos = GenTime(m_remapLink->anim_get_double("map", m_bottomPosition + m_inFrame)).frames(pCore->getCurrentFps()) - m_inFrame;
scaledPos = topPos * m_scale;
scaledPos -= m_zoomStart;
scaledPos *= m_zoomFactor;
scaledPos += m_offset;
}
double scaledPos2 = m_bottomPosition * m_scale;
scaledPos2 -= m_zoomStart;
scaledPos2 *= m_zoomFactor;
......@@ -1428,8 +1433,10 @@ void RemapView::paintEvent(QPaintEvent *event)
p.setBrush(m_colSelected);
p.drawPolygon(bottomCursor );
}
p.drawLine(scaledPos, m_lineHeight * 1.75, scaledPos2, m_bottomView - (m_lineHeight * 1.75));
p.drawLine(scaledPos, m_lineHeight, scaledPos, m_lineHeight * 1.75);
if (scaledPos > -1) {
p.drawLine(scaledPos, m_lineHeight * 1.75, scaledPos2, m_bottomView - (m_lineHeight * 1.75));
p.drawLine(scaledPos, m_lineHeight, scaledPos, m_lineHeight * 1.75);
}
p.drawLine(scaledPos2, m_bottomView - m_lineHeight, scaledPos2, m_bottomView - m_lineHeight * 1.75);
}
......
......@@ -266,10 +266,7 @@ bool ProjectManager::closeCurrentDocument(bool saveChanges, bool quit)
}
}
::mlt_pool_purge();
pCore->audioThumbCache.clear();
pCore->taskManager.slotCancelJobs();
disconnect(pCore->window()->getMainTimeline()->controller(), &TimelineController::durationChanged, this, &ProjectManager::adjustProjectDuration);
pCore->window()->getMainTimeline()->controller()->clipActions.clear();
pCore->cleanup();
if (!quit && !qApp->isSavingSession()) {
m_autoSaveTimer.stop();
if (m_project) {
......
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