From f029a3d88fa6717d893c43a4bf186279a428cf29 Mon Sep 17 00:00:00 2001 From: Piotr Jarosik Date: Fri, 17 Dec 2021 09:19:47 +0100 Subject: [PATCH] Us4R buffer unregistration will be performed only once. --- arrus/core/devices/us4r/Us4RImpl.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arrus/core/devices/us4r/Us4RImpl.cpp b/arrus/core/devices/us4r/Us4RImpl.cpp index 29b834c6d..a1ca547cb 100644 --- a/arrus/core/devices/us4r/Us4RImpl.cpp +++ b/arrus/core/devices/us4r/Us4RImpl.cpp @@ -155,7 +155,10 @@ void Us4RImpl::stopDevice() { if (this->buffer != nullptr) { this->buffer->shutdown(); std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - getProbeImpl()->unregisterOutputBuffer(this->buffer.get(), this->us4rBuffer); + if(this->us4rBuffer) { + getProbeImpl()->unregisterOutputBuffer(this->buffer.get(), this->us4rBuffer); + this->us4rBuffer.reset(); + } } this->state = State::STOPPED; }