Fix crash on group move. Related to #435

parent 96016e61
......@@ -1407,7 +1407,7 @@ bool TimelineModel::requestGroupMove(int itemId, int groupId, int delta_track, i
// Sort clips first
std::vector<int> sorted_clips(all_clips.begin(), all_clips.end());
std::sort(sorted_clips.begin(), sorted_clips.end(), [this, delta_pos](int clipId1, int clipId2) {
std::sort(sorted_clips.begin(), sorted_clips.end(), [this, delta_pos](const int clipId1, const int clipId2) {
int p1 = m_allClips[clipId1]->getPosition();
int p2 = m_allClips[clipId2]->getPosition();
return delta_pos > 0 ? p2 <= p1 : p1 <= p2;
......@@ -1415,7 +1415,7 @@ bool TimelineModel::requestGroupMove(int itemId, int groupId, int delta_track, i
// Sort compositions. We need to delete in the move direction from top to bottom
std::vector<int> sorted_compositions(all_compositions.begin(), all_compositions.end());
std::sort(sorted_compositions.begin(), sorted_compositions.end(), [this, delta_track, delta_pos](int clipId1, int clipId2) {
std::sort(sorted_compositions.begin(), sorted_compositions.end(), [this, delta_track, delta_pos](const int clipId1, const int clipId2) {
int p1 = delta_track < 0
? getTrackMltIndex(m_allCompositions[clipId1]->getCurrentTrackId())
: delta_track > 0 ? -getTrackMltIndex(m_allCompositions[clipId1]->getCurrentTrackId()) : m_allCompositions[clipId1]->getPosition();
......
......@@ -1104,12 +1104,16 @@ void TimelineController::cutClipUnderCursor(int position, int track)
int TimelineController::requestSpacerStartOperation(int trackId, int position)
{
return TimelineFunctions::requestSpacerStartOperation(m_model, trackId, position);
QMutexLocker lk(&m_metaMutex);
int itemId = TimelineFunctions::requestSpacerStartOperation(m_model, trackId, position);
return itemId;
}
bool TimelineController::requestSpacerEndOperation(int clipId, int startPosition, int endPosition)
{
return TimelineFunctions::requestSpacerEndOperation(m_model, clipId, startPosition, endPosition);
QMutexLocker lk(&m_metaMutex);
bool result = TimelineFunctions::requestSpacerEndOperation(m_model, clipId, startPosition, endPosition);
return result;
}
void TimelineController::seekCurrentClip(bool seekToEnd)
......@@ -2387,7 +2391,7 @@ bool TimelineController::endFakeGroupMove(int clipId, int groupId, int delta_tra
// Sort clips. We need to delete from right to left to avoid confusing the view
std::vector<int> sorted_clips(all_items.begin(), all_items.end());
std::sort(sorted_clips.begin(), sorted_clips.end(), [this](int clipId1, int clipId2) {
std::sort(sorted_clips.begin(), sorted_clips.end(), [this](const int clipId1, const int clipId2) {
int p1 = m_model->isClip(clipId1) ? m_model->m_allClips[clipId1]->getPosition() : m_model->m_allCompositions[clipId1]->getPosition();
int p2 = m_model->isClip(clipId2) ? m_model->m_allClips[clipId2]->getPosition() : m_model->m_allCompositions[clipId2]->getPosition();
return p2 <= p1;
......
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