File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed
Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -230,17 +230,20 @@ def disconnect(self, cid):
230230
231231 No error is raised if such a callback does not exist.
232232 """
233- for eventname , callbackd in list (self .callbacks .items ()):
234- try :
235- del callbackd [cid ]
236- except KeyError :
237- continue
238- else :
239- for signal , functions in list (self ._func_cid_map .items ()):
240- for function , value in list (functions .items ()):
241- if value == cid :
242- del functions [function ]
243- return
233+ # Clean up callbacks
234+ for signal , cid_to_proxy in list (self .callbacks .items ()):
235+ proxy = cid_to_proxy .pop (cid , None )
236+ if proxy is not None :
237+ break
238+ else :
239+ # Not found
240+ return
241+
242+ proxy_to_cid = self ._func_cid_map [signal ]
243+ for current_proxy , current_cid in list (proxy_to_cid .items ()):
244+ if current_cid == cid :
245+ assert proxy is current_proxy
246+ del proxy_to_cid [current_proxy ]
244247
245248 def process (self , s , * args , ** kwargs ):
246249 """
You can’t perform that action at this time.
0 commit comments