MusicPipe: automatically clear in destructor
We can implement this now that we have a MusicBuffer reference.
This commit is contained in:
parent
9f14e7a98d
commit
e81b089612
@ -67,12 +67,8 @@ public:
|
||||
|
||||
MusicPipe(const MusicPipe &) = delete;
|
||||
|
||||
/**
|
||||
* Frees the object. It must be empty now.
|
||||
*/
|
||||
~MusicPipe() {
|
||||
assert(head == nullptr);
|
||||
assert(tail_r == &head);
|
||||
~MusicPipe() noexcept {
|
||||
Clear();
|
||||
}
|
||||
|
||||
MusicPipe &operator=(const MusicPipe &) = delete;
|
||||
|
@ -407,11 +407,8 @@ MultipleOutputs::Close() noexcept
|
||||
for (auto *ao : outputs)
|
||||
ao->LockCloseWait();
|
||||
|
||||
if (pipe != nullptr) {
|
||||
pipe->Clear();
|
||||
delete pipe;
|
||||
pipe = nullptr;
|
||||
}
|
||||
delete pipe;
|
||||
pipe = nullptr;
|
||||
|
||||
input_audio_format.Clear();
|
||||
|
||||
@ -424,11 +421,8 @@ MultipleOutputs::Release() noexcept
|
||||
for (auto *ao : outputs)
|
||||
ao->LockRelease();
|
||||
|
||||
if (pipe != nullptr) {
|
||||
pipe->Clear();
|
||||
delete pipe;
|
||||
pipe = nullptr;
|
||||
}
|
||||
delete pipe;
|
||||
pipe = nullptr;
|
||||
|
||||
input_audio_format.Clear();
|
||||
|
||||
|
@ -169,14 +169,9 @@ private:
|
||||
xfade_state = CrossFadeState::UNKNOWN;
|
||||
}
|
||||
|
||||
void ClearAndDeletePipe() noexcept {
|
||||
pipe->Clear();
|
||||
delete pipe;
|
||||
}
|
||||
|
||||
void ClearAndReplacePipe(MusicPipe *_pipe) noexcept {
|
||||
ResetCrossFade();
|
||||
ClearAndDeletePipe();
|
||||
delete pipe;
|
||||
pipe = _pipe;
|
||||
}
|
||||
|
||||
@ -1070,7 +1065,7 @@ Player::Run() noexcept
|
||||
CancelPendingSeek();
|
||||
StopDecoder();
|
||||
|
||||
ClearAndDeletePipe();
|
||||
delete pipe;
|
||||
|
||||
cross_fade_tag.reset();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user