Tag: skip tag pool lock if there are no items
This commit is contained in:
parent
0efbd4df8b
commit
ab687481cc
@ -29,15 +29,16 @@ Tag::Clear() noexcept
|
|||||||
duration = SignedSongTime::Negative();
|
duration = SignedSongTime::Negative();
|
||||||
has_playlist = false;
|
has_playlist = false;
|
||||||
|
|
||||||
{
|
if (num_items > 0) {
|
||||||
|
assert(items != nullptr);
|
||||||
const std::scoped_lock<Mutex> protect(tag_pool_lock);
|
const std::scoped_lock<Mutex> protect(tag_pool_lock);
|
||||||
for (unsigned i = 0; i < num_items; ++i)
|
for (unsigned i = 0; i < num_items; ++i)
|
||||||
tag_pool_put_item(items[i]);
|
tag_pool_put_item(items[i]);
|
||||||
|
num_items = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] items;
|
delete[] items;
|
||||||
items = nullptr;
|
items = nullptr;
|
||||||
num_items = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Tag::Tag(const Tag &other) noexcept
|
Tag::Tag(const Tag &other) noexcept
|
||||||
|
Loading…
Reference in New Issue
Block a user