]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5718 Fix memory leak
authorStas Vilchik <vilchiks@gmail.com>
Mon, 24 Nov 2014 15:05:05 +0000 (16:05 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 24 Nov 2014 15:05:05 +0000 (16:05 +0100)
server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee

index e106896b9e995c292ea29c14aa6c3407c88cb826..3fd1d00010e8deb1d13d67efbe201bffc24708d3 100644 (file)
@@ -42,6 +42,7 @@ define [
         formattedSource: []
       @component = new Backbone.Model()
       @issues = new Issues()
+      @issueViews = []
       @listenTo options.app.state, 'change:selectedIndex', @select
       @loadSourceBeforeThrottled = _.throttle @loadSourceBefore, 1000
       @loadSourceAfterThrottled = _.throttle @loadSourceAfter, 1000
@@ -144,6 +145,8 @@ define [
 
 
     onClose: ->
+      @issueViews.forEach (view) -> view.close()
+      @issuesView = []
       @unbindScrollEvents()
       @unbindShortcuts()
 
@@ -171,6 +174,7 @@ define [
       line = issue.get('line') || 0
       row = @$("[data-line-number=#{line}]")
       issueView = new IssueView app: @options.app, model: issue
+      @issueViews.push issueView
       if line == 0
         issueView.render().$el.insertBefore @$('.issues-workspace-component-viewer-code')
       else