mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
fix($rootScope.$on) check listener existense while deregistering
Check that listener is still present in $$listeners before decrease $$listenerCount. It fixes problem with incorrect $$listenerCount after call deregistering function multiple times. Closes #9666 Closes #9667
This commit is contained in:
@@ -979,8 +979,11 @@ function $RootScopeProvider(){
|
||||
|
||||
var self = this;
|
||||
return function() {
|
||||
namedListeners[indexOf(namedListeners, listener)] = null;
|
||||
decrementListenerCount(self, 1, name);
|
||||
var indexOfListener = indexOf(namedListeners, listener);
|
||||
if (indexOfListener !== -1) {
|
||||
namedListeners[indexOfListener] = null;
|
||||
decrementListenerCount(self, 1, name);
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user