Fix groups on upper track disappearing when inserting a new track

Prevent possible crash on autosave
parent b00844ae
......@@ -298,6 +298,7 @@ QString ClipManager::projectFolder() const
AbstractGroupItem *ClipManager::createGroup()
{
QMutexLocker lock(&m_groupsMutex);
AbstractGroupItem *group = new AbstractGroupItem(m_doc->fps());
m_groupsList.append(group);
return group;
......@@ -310,16 +311,19 @@ int ClipManager::lastClipId() const
void ClipManager::removeGroup(AbstractGroupItem *group)
{
QMutexLocker lock(&m_groupsMutex);
m_groupsList.removeAll(group);
}
void ClipManager::resetGroups()
{
QMutexLocker lock(&m_groupsMutex);
m_groupsList.clear();
}
QString ClipManager::groupsXml() const
QString ClipManager::groupsXml()
{
QMutexLocker lock(&m_groupsMutex);
if (m_groupsList.isEmpty()) {
return QString();
}
......
......@@ -82,7 +82,7 @@ Q_OBJECT public:
void removeGroup(AbstractGroupItem *group);
/** @brief Delete groups list, prepare for a reload. */
void resetGroups();
QString groupsXml() const;
QString groupsXml();
/** @brief remove a clip id from the queue list. */
void stopThumbs(const QString &id);
void projectTreeThumbReady(const QString &id, int frame, const QImage &img, int type);
......@@ -91,7 +91,7 @@ Q_OBJECT public:
public slots:
/** @brief Request creation of a clip thumbnail for specified frames. */
void slotRequestThumbs(const QString &id, const QList<int> &frames);
private slots:
void slotGetThumbs();
/** @brief Clip has been copied, add it now. */
......@@ -123,6 +123,7 @@ private: // Private attributes
QString m_processingAudioThumbId;
/** @brief The list of removable drives. */
QVector <SolidVolumeInfo> m_removableVolumes;
QMutex m_groupsMutex;
QPoint m_projectTreeThumbSize;
......
......@@ -3523,7 +3523,7 @@ void CustomTrackView::addTrack(const TrackInfo &type, int ix)
QDomElement elem = nodes.item(itemindex).toElement();
if (!elem.hasAttribute("track")) continue;
int track = elem.attribute("track").toInt();
if (track <= ix) {
if (track < ix) {
// No change
continue;
}
......
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