Skip to content

Commit

Permalink
Return a local copy of m_cuePoints to avaoid a race consition
Browse files Browse the repository at this point in the history
The QList copy constructor seems to be not thread-safe in case it is not already shared.
  • Loading branch information
daschuer committed Oct 17, 2022
1 parent e3759aa commit a4c9cab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/track/track.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,9 @@ class Track : public QObject {
void removeCue(const CuePointer& pCue);
void removeCuesOfType(mixxx::CueType);
QList<CuePointer> getCuePoints() const {
// Copying implicitly shared collections is thread-safe
return m_cuePoints;
const QMutexLocker lock(&m_qMutex);
QList<CuePointer> cuePoints = m_cuePoints;
return cuePoints;
}

void setCuePoints(const QList<CuePointer>& cuePoints);
Expand Down

0 comments on commit a4c9cab

Please sign in to comment.