From 4ee05eb443ccf00c6b39a6eb88252123fb8f3880 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 26 Sep 2023 14:50:57 +0200 Subject: [PATCH] chore(dlgprefsound): Make container cost to prevent detach in loop --- src/preferences/dialog/dlgprefsound.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/preferences/dialog/dlgprefsound.cpp b/src/preferences/dialog/dlgprefsound.cpp index bc4e66640af..b1d6e75e748 100644 --- a/src/preferences/dialog/dlgprefsound.cpp +++ b/src/preferences/dialog/dlgprefsound.cpp @@ -68,7 +68,8 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent, &DlgPrefSound::apiChanged); sampleRateComboBox->clear(); - for (const auto& sampleRate : m_pSoundManager->getSampleRates()) { + const auto sampleRates = m_pSoundManager->getSampleRates(); + for (const auto& sampleRate : sampleRates) { if (sampleRate.isValid()) { // no ridiculous sample rate values. prohibiting zero means // avoiding a potential div-by-0 error in ::updateLatencies