paulpflug / foldername-tabs

Adds foldernames to tabs..
MIT License
16 stars 6 forks source link

Version 0.1.8 causes error when the last tab in a pane is closed #8

Closed kankaristo closed 8 years ago

kankaristo commented 8 years ago

I recently updated foldername-tabs to version 0.1.8 and started getting an error when I close the last tab in a pane.

Atom's error dialog points to https://github.com/atom/tabs/issues/253, but the error doesn't happen in safe mode, or if I disable the foldername-tabs package. It also started happening very close to version 0.1.8 being released, so it's probably caused by some change in that version.

Steps to reproduce:

  1. Split pane (e.g. ctrl-k, right arrow)
  2. Close the tab in the split pane
  3. Error

Atom Version: 1.5.0-beta1 System: Ubuntu 15.10 Thrown From: tabs package, v0.88.0

Stack Trace

Uncaught TypeError: Cannot read property 'forEach' of undefined

At /usr/share/atom-beta/resources/app.asar/node_modules/event-kit/lib/composite-disposable.js:24

TypeError: Cannot read property 'forEach' of undefined
    at module.exports.CompositeDisposable.dispose (/usr/share/atom-beta/resources/app.asar/node_modules/event-kit/lib/composite-disposable.js:24:25)
    at Function.module.exports.Emitter.simpleDispatch (/usr/share/atom-beta/resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/usr/share/atom-beta/resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at Pane.module.exports.Pane.destroyed (/usr/share/atom-beta/resources/app.asar/src/pane.js:659:20)
    at Pane.module.exports.Model.destroy (/usr/share/atom-beta/resources/app.asar/src/model.js:31:58)
    at Pane.module.exports.Pane.destroy (/usr/share/atom-beta/resources/app.asar/src/pane.js:650:39)
    at Pane.module.exports.Pane.removeItem (/usr/share/atom-beta/resources/app.asar/src/pane.js:422:21)
    at Pane.module.exports.Pane.destroyItem (/usr/share/atom-beta/resources/app.asar/src/pane.js:464:16)
    at atom-tabs.TabBarView.onMouseDown (/usr/share/atom-beta/resources/app.asar/node_modules/tabs/lib/tab-bar-view.js:677:19)
paulpflug commented 8 years ago

I clearly don't understand why this occurs, probably a race condition, but I don't see where. Here the forEach throws:

unless @disposed
  @disposed = true
  @disposables.forEach (disposable) ->
    disposable.dispose()
  @disposables = null

and the @disposables = null is the only nulling. So It "should" be impossible to throw ^^ I added an additional check if @disposables is null, now it works.

kankaristo commented 8 years ago

Yep, seems to be fixed, thanks! :+1:

Another more minor thing: the folder name doesn't show up right away after creating a split. Moving or closing a tab seems to update it, but it doesn't show up right away.

It's a really minor bug though, and probably won't bother anyone too much.

paulpflug commented 8 years ago

I will look into it. splitting in from the tree view works but from the tabs bar not.. as always strange ;)

paulpflug commented 8 years ago

works for me in 0.1.10 :smile:

kankaristo commented 8 years ago

Working nicely, thanks again! :smile: