     @workspaceRef.child("tabs").push workspaceRefData  unless sessionKey
 
     pane.on "KDTabPaneDestroy", =>
+      removedPaneIndex = @tabView.getPaneIndex pane
+      @editors.splice removedPaneIndex, 1
       @workspaceRef.once "value", (snapshot) =>
         {tabs} = snapshot.val()
         return unless tabs


    @workspaceRef.onDisconnect().remove()  if @workspace.amIHost()

  getActivePaneContent: ->
    return @tabView.getActivePane().subViews[0].getValue()

  getActivePaneFileData: ->
    return @tabView.getActivePane().subViews[0].getData()

  getActivePane: ->
    return @tabView.getActivePane()

  createEditorTabs: ->
    @tabHandleContainer = new ApplicationTabHandleHolder

    super options, data

    @openedFiles      = []
    @editors          = []
    @activeTabIndex   = 0

    @createEditorTabs()
