MCPcopy Create free account
hub / github.com/audacity/audacity / ClearPendingTracks

Method ClearPendingTracks

libraries/lib-track/PendingTracks.cpp:197–224  ·  view source on GitHub ↗

! @excsafety{No-fail} */

Source from the content-addressed store, hash-verified

195
196/*! @excsafety{No-fail} */
197void PendingTracks::ClearPendingTracks(
198 std::vector<std::shared_ptr<Track>> *pAdded)
199{
200 mUpdaters.clear();
201 mPendingUpdates->Clear();
202
203 if (pAdded)
204 pAdded->clear();
205
206 auto [it, end] = mTracks.Any();
207 while (it != end) {
208 const auto pTrack = *it;
209 ++it;
210 if (pTrack->GetId() == TrackId{}) {
211 if (pAdded)
212 pAdded->emplace_back(mTracks.Remove(*pTrack));
213 }
214 else {
215 if (pAdded)
216 pAdded->push_back(nullptr);
217 }
218 }
219
220 if (pAdded)
221 // Remove trailing nulls
222 while (!pAdded->empty() && !pAdded->back())
223 pAdded->pop_back();
224}
225
226/*! @excsafety{Strong} */
227bool PendingTracks::ApplyPendingTracks()

Callers 3

OnExceptionInMainLoopMethod · 0.80
CancelRecordingMethod · 0.80
cancelRecordingMethod · 0.80

Calls 7

GetIdMethod · 0.80
clearMethod · 0.45
ClearMethod · 0.45
AnyMethod · 0.45
RemoveMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected