Fix #111702: Crash accessing KeyMapItem.properties on script reload

This commit is contained in:
Campbell Barton
2023-08-31 12:04:30 +10:00
parent 1ffc0a9e64
commit 88a875ec3a

View File

@@ -285,6 +285,13 @@ def load_scripts(*, reload_scripts=False, refresh_scripts=False):
del _global_loaded_modules[:]
# Update key-maps to account for operators no longer existing.
# Typically unloading operators would refresh the event system (such as disabling an add-on)
# however reloading scripts re-enable all add-ons immediately (which may inspect key-maps).
# For this reason it's important to update key-maps which will have been tagged to update.
# Without this, add-on register functions accessing key-map properties can crash, see: #111702.
_bpy.context.window_manager.keyconfigs.update()
from bpy_restrict_state import RestrictBlend
with RestrictBlend():