Bug 510435

Summary: When plugging in a headset, the "Audio Input" list under "Settings" contains many duplicated entries
Product: [Applications] krecorder Reporter: Tobias Burnus <burnus>
Component: generalAssignee: Devin Lin <espidev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 25.08.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Tobias Burnus 2025-10-09 19:02:49 UTC
At startup, I have two entries in "Audio Input" list under "Settings"; when I plug in a headset, I have suddenly all entries 6 times.

It seems as if inserting the headset correctly triggers some events, but they get appended/inserted into the list instead of first clearing the list – and then adding the entries. – Or, alternatively, checking that an item does not exist before inserting/appending it.
Comment 1 Tobias Burnus 2025-10-10 21:33:30 UTC
src/contents/ui/settings/SettingsComponent.qml has:

            Connections {
                target: AudioRecorder
                function onAudioInputChanged() {
                    audioInputDropdown.refreshAudioInputs();

Untested patch:
------------------------------
--- a/src/contents/ui/settings/SettingsComponent.qml
+++ b/src/contents/ui/settings/SettingsComponent.qml
@@ -74,6 +74,7 @@ ColumnLayout {
 
             function refreshAudioInputs() {
                 currentIndex = 0;
+                inputModel.clear();
                 for (let i = 0; i < mediaDevices.audioInputs.length; i++) {
                     let device = mediaDevices.audioInputs[i];
                     inputModel.append({"name": device.description, "deviceId": device.id});
------------------------------
Comment 2 Bug Janitor Service 2025-12-02 09:23:30 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/krecorder/-/merge_requests/62
Comment 3 Bug Janitor Service 2025-12-03 01:38:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/krecorder/-/merge_requests/63
Comment 4 Devin Lin 2025-12-04 00:52:33 UTC
Git commit 2db342e6e60827eca830dac95c8aa7da41b8ac64 by Devin Lin, on behalf of Aleix Pol Gonzalez.
Committed on 04/12/2025 at 00:50.
Pushed by devinlin into branch 'release/25.12'.

Audio Input list - refreshAudioInputs: Clear before appending devices

On onAudioInputChanged, the audio devices are re-read. However, the
list needs to be cleared before to avoid duplicated entries.


(cherry picked from commit 3c54d292930c790e7c49608553eabd981d5417de)

Co-authored-by: Tobias Burnus <burnus@net-b.de>

M  +1    -0    src/contents/ui/settings/SettingsComponent.qml

https://invent.kde.org/utilities/krecorder/-/commit/2db342e6e60827eca830dac95c8aa7da41b8ac64