Mercurial > hg > svcore
comparison base/XmlExportable.cpp @ 1683:e4f31f506116 single-point
Start ids at 0 - backward-compatibility makes testing easier
| author | Chris Cannam | 
|---|---|
| date | Wed, 03 Apr 2019 16:03:39 +0100 | 
| parents | f97d64b8674f | 
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| 1682:4ca784e5033e | 1683:e4f31f506116 | 
|---|---|
| 70 int | 70 int | 
| 71 XmlExportable::getExportId() const | 71 XmlExportable::getExportId() const | 
| 72 { | 72 { | 
| 73 if (m_exportId == -1) { | 73 if (m_exportId == -1) { | 
| 74 static QMutex mutex; | 74 static QMutex mutex; | 
| 75 static int lastId = 0; | 75 static int nextId = 0; | 
| 76 QMutexLocker locker(&mutex); | 76 QMutexLocker locker(&mutex); | 
| 77 if (m_exportId == -1) { | 77 if (m_exportId == -1) { | 
| 78 m_exportId = ++lastId; | 78 m_exportId = nextId; | 
| 79 ++nextId; | |
| 79 } | 80 } | 
| 80 } | 81 } | 
| 81 return m_exportId; | 82 return m_exportId; | 
| 82 } | 83 } | 
| 83 | 84 | 
