diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-10-19 09:49:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-10-19 09:49:48 +0300 |
commit | 0bbc6a903a5baf4782b99c70bee6c45fd017c519 (patch) | |
tree | d736423634f0cf48d4a2f2122be0a4778dbfece9 | |
parent | de3f9303eb958d34e4793ff91fafedda0b41ee98 (diff) |
Fix error disabling all addons
-rw-r--r-- | release/scripts/modules/addon_utils.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index dc7f4053a01..713a11362c6 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -472,7 +472,12 @@ def reset_all(*, reload_scripts=False): def disable_all(): import sys - for mod_name, mod in sys.modules.items(): + # Collect modules to disable first because dict can be modified as we disable. + addon_modules = [ + item for item in sys.modules.items() + if getattr(item[1], "__addon_enabled__", False) + ] + for mod_name, mod in addon_modules: if getattr(mod, "__addon_enabled__", False): disable(mod_name) |