mirror of
https://github.com/miek/inspectrum.git
synced 2026-03-03 06:54:17 +01:00
samplebuffer: Acquire lock during work function
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <QMutexLocker>
|
||||
#include "samplebuffer.h"
|
||||
|
||||
template <typename Tin, typename Tout>
|
||||
@@ -39,6 +40,7 @@ std::unique_ptr<Tout[]> SampleBuffer<Tin, Tout>::getSamples(off_t start, off_t l
|
||||
return nullptr;
|
||||
|
||||
std::unique_ptr<Tout[]> dest(new Tout[length]);
|
||||
QMutexLocker ml(&mutex);
|
||||
work(samples.get(), dest.get(), length);
|
||||
return dest;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user