From a03e639c8b4a6745c3e8386450dfbfb32c577d6e Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 19 Sep 2024 16:41:57 -0700 Subject: [PATCH] Fix removing immutable settings for lists Settings can have multiple values, although this is not often used and the UI has places where this is not properly honored. Fix the case where we look for and prune uninitialized/immutable settings and be sure to iterate over all the values to avoid a crash. Fixes #11549 --- chirp/wxui/settingsedit.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/chirp/wxui/settingsedit.py b/chirp/wxui/settingsedit.py index 944ec1afd..8924f6a62 100644 --- a/chirp/wxui/settingsedit.py +++ b/chirp/wxui/settingsedit.py @@ -164,12 +164,13 @@ def _remove_dead_settings(self, root): if isinstance(e, settings.RadioSetting): # Immutable and uninitialized settings don't get sent to the # radio - if not e.value.get_mutable(): - LOG.debug('Skipping immutable %s', e.get_name()) - del root[e] - elif not e.value.initialized: - LOG.debug('Skipping uninitialized %s', e.get_name()) - del root[e] + for value in e: + if not value.get_mutable(): + LOG.debug('Skipping immutable %s', e.get_name()) + del root[e] + elif not value.initialized: + LOG.debug('Skipping uninitialized %s', e.get_name()) + del root[e] elif isinstance(e, settings.RadioSettingGroup): self._remove_dead_settings(e)