diff --git a/lib/matplotlib/cbook.py b/lib/matplotlib/cbook.py index 185f22d5a14e..c1deca6180ac 100644 --- a/lib/matplotlib/cbook.py +++ b/lib/matplotlib/cbook.py @@ -323,9 +323,10 @@ def disconnect(self, cid): except KeyError: continue else: - for key, value in self._func_cid_map.items(): - if value == cid: - del self._func_cid_map[key] + for category, functions in self._func_cid_map.items(): + for function, value in functions.items(): + if value == cid: + del functions[function] return def process(self, s, *args, **kwargs):