[Bf-extensions-cvs] [5fdd75d6] master: BlenderKit: fix T67565, unregistration could go wrong in combo with other addons since addon was un-registering whole keymap

Vilém Duha noreply at git.blender.org
Wed Jul 24 08:40:59 CEST 2019


Commit: 5fdd75d68328cb3257a9792c6deb84e49b606375
Author: Vilém Duha
Date:   Wed Jul 24 08:40:42 2019 +0200
Branches: master
https://developer.blender.org/rBA5fdd75d68328cb3257a9792c6deb84e49b606375

BlenderKit: fix  T67565, unregistration could go wrong in combo with other addons since addon was un-registering whole keymap

===================================================================

M	blenderkit/ui.py

===================================================================

diff --git a/blenderkit/ui.py b/blenderkit/ui.py
index 40a10904..d58c489b 100644
--- a/blenderkit/ui.py
+++ b/blenderkit/ui.py
@@ -1648,8 +1648,8 @@ classess = (
 
 )
 
-# store keymaps here to access after registration
-addon_keymaps = []
+# store keymap items here to access after registration
+addon_keymapitems = []
 
 
 def register_ui():
@@ -1673,7 +1673,7 @@ def register_ui():
     kmi.properties.keep_running = False
     kmi.properties.do_search = False
 
-    addon_keymaps.append(km)
+    addon_keymapitems.append(kmi)
 
 
 def unregister_ui():
@@ -1685,12 +1685,11 @@ def unregister_ui():
     for c in classess:
         bpy.utils.unregister_class(c)
 
-    args = (None, bpy.context)
-
     wm = bpy.context.window_manager
     if not wm.keyconfigs.addon:
         return
 
-    for km in addon_keymaps:
-        wm.keyconfigs.addon.keymaps.remove(km)
-    del addon_keymaps[:]
+    km = wm.keyconfigs.addon.keymaps['Window']
+    for kmi in addon_keymapitems:
+        km.keymap_items.remove(kmi)
+    del addon_keymapitems[:]



More information about the Bf-extensions-cvs mailing list