Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
perf(rootScope): Fix a memory leak
Browse files Browse the repository at this point in the history
Closes #11169
  • Loading branch information
realityking authored and petebacondarwin committed Mar 9, 2015
1 parent 4f1f9cf commit 9256094
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ng/rootScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ function $RootScopeProvider() {
this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser',
function($injector, $exceptionHandler, $parse, $browser) {

function destroyChildScope($event) {
$event.currentScope.$$destroyed = true;
}

/**
* @ngdoc type
* @name $rootScope.Scope
Expand Down Expand Up @@ -233,13 +237,9 @@ function $RootScopeProvider() {
// prototypically. In all other cases, this property needs to be set
// when the parent scope is destroyed.
// The listener needs to be added after the parent is set
if (isolate || parent != this) child.$on('$destroy', destroyChild);
if (isolate || parent != this) child.$on('$destroy', destroyChildScope);

return child;

function destroyChild() {
child.$$destroyed = true;
}
},

/**
Expand Down

0 comments on commit 9256094

Please sign in to comment.