diff --git a/src/app/directives/addPanel.js b/src/app/directives/addPanel.js index 2887a54a35e..4d7dee74901 100644 --- a/src/app/directives/addPanel.js +++ b/src/app/directives/addPanel.js @@ -12,6 +12,11 @@ function (angular, app, _) { return { restrict: 'A', link: function($scope, elem) { + + $scope.$on("$destroy",function() { + elem.remove(); + }); + $scope.$watch('panel.type', function() { var _type = $scope.panel.type; $scope.reset_panel(_type); diff --git a/src/app/directives/kibanaPanel.js b/src/app/directives/kibanaPanel.js index 009fb8f8e41..49283b8d00a 100644 --- a/src/app/directives/kibanaPanel.js +++ b/src/app/directives/kibanaPanel.js @@ -13,7 +13,6 @@ function (angular) { '
' + - '' + ''+ diff --git a/src/vendor/angular/angular.js b/src/vendor/angular/angular.js index d2115fe1d80..85d0cdca93a 100644 --- a/src/vendor/angular/angular.js +++ b/src/vendor/angular/angular.js @@ -8464,6 +8464,21 @@ function $RootScopeProvider(){ } else { this.$$childHead = this.$$childTail = child; } + + // RASHID: Fix for chrome GC bug + child.$on('$destroy', function() { + if(Child) + Child.prototype = null; + // Async so that the $broadcast('$destroy') can traverse the rest + setTimeout(function() { + child.__proto__ = {}; + for(var i in child) + child[i] = null; + child = null; + return null; + }); + }); + return child; }, @@ -8893,6 +8908,8 @@ function $RootScopeProvider(){ // see: https://github.com/angular/angular.js/issues/1313#issuecomment-10378451 this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead = this.$$childTail = null; + parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead = + this.$$childTail = null; }, /**