atom / tabs

Tabs in Atom
MIT License
111 stars 118 forks source link

Uncaught TypeError: Cannot read property 'getAllowedLocations' of undefined #433

Open vnt opened 7 years ago

vnt commented 7 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.17.0-beta0 x64 Electron: 1.3.14 OS: Mac OS X 10.11.6 Thrown From: tabs package 0.105.4

Stack Trace

Uncaught TypeError: Cannot read property 'getAllowedLocations' of undefined

At /Applications/WebDesign/Atom Beta.app/Contents/Resources/app/node_modules/tabs/lib/layout.js:159

TypeError: Cannot read property 'getAllowedLocations' of undefined
    at itemIsAllowedInPane (/Applications/WebDesign/Atom Beta.app/Contents/Resources/app/node_modules/tabs/lib/layout.js:159:1)
    at Object.end (/Applications/WebDesign/Atom Beta.app/Contents/Resources/app/node_modules/tabs/lib/layout.js:42:1)
    at HTMLLIElement.TabView.element.ondragend (/Applications/WebDesign/Atom Beta.app/Contents/Resources/app/node_modules/tabs/lib/tab-view.js:62:1)

Commands

     -4:50.6.0 recent-projects:open (atom-workspace.workspace.scrollbars-visible-when-scrolling)
     -4:46.2.0 tree-view:show (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-one-dark-syntax.theme-one-dark-ui)
  2x -4:23.4.0 editor:toggle-soft-wrap (div.tool-panel.tree-view)
     -0:36.6.0 tool-bar:position-top (div.tool-bar.tool-bar-left.tool-bar-vertical.tool-bar-16px)
     -0:29.9.0 tool-bar:position-right (div.tool-bar.tool-bar-top.tool-bar-horizontal.tool-bar-16px)

Non-Core Packages

auto-detect-indentation 1.3.0 
autoclose-html 0.23.0 
busy-signal 1.3.0 
cakephp3-snippets 0.5.0 
chrome-color-picker 0.8.0 
color-picker 2.2.5 
color-tabs 0.1.8 
css-color-name 0.4.0 
file-icons 2.1.2 
file-types 0.5.5 
git-plus 7.4.0 
git-time-machine 1.5.9 
goto-definition 1.3.1 
intentions 1.1.2 
language-smarty 1.8.0 
linter 2.1.2 
linter-csslint 1.3.4 
linter-htmlhint 1.3.3 
linter-jshint 3.0.3 
linter-php 1.3.2 
linter-ui-default 1.2.2 
minimap 4.27.1 
minimap-find-and-replace 4.5.2 
open-recent 5.0.0 
pigments 0.39.1 
pinegrow-atom 0.3.1 
recent-projects 0.13.1 
simple-drag-drop-text 0.3.4 
tag 0.5.0 
todo-show 1.11.0 
tool-bar 1.1.0 
tool-bar-atom 1.7.0 
tree-view-autoresize 1.6.0 
Ben3eeE commented 7 years ago

What were you doing when you got the exception?

vnt commented 7 years ago

I was moving the project column from left to right

rsese commented 7 years ago

Thanks @vnt - is the error reproducible for you? I just gave it a try with 1.17.0-beta0 and couldn't reproduce.

cpierce commented 7 years ago

just had the same thing happen on 1.17 stable.

akodkod commented 7 years ago

Got the same error as @vnt

50Wliu commented 7 years ago

@cpierce, @MrEmelianenko can you please paste the output of apm list --installed here? Thanks!


The commands list provided by @vnt suggests that this happens when workspace items aren't implementing the new Dock methods.

cpierce commented 7 years ago
├── api-blueprint-preview@0.7.0
├── atom-beautify@0.29.26
├── busy-signal@1.4.3
├── docblockr@0.10.3
├── file-icons@2.1.7
├── git-control@0.9.0
├── git-log@0.4.1
├── git-time-machine@1.5.9
├── highlight-line@0.12.0
├── highlight-selected@0.13.1
├── intentions@1.1.2
├── jellybeans@1.5.0
├── language-api-blueprint@1.0.2
├── language-scala@1.1.8
├── linter@2.1.4
├── linter-php@1.3.2
├── linter-ui-default@1.6.1
├── minimap@4.28.2
├── minimap-bookmarks@0.4.2
├── minimap-cursorline@0.2.0
├── minimap-find-and-replace@4.5.2
├── minimap-git-diff@4.3.1
├── minimap-highlight-selected@4.6.1
├── minimap-selection@4.4.0
├── phpunit@1.2.0
├── project-manager@3.3.5
├── project-view@0.6.2
├── tree-view-git-status@1.4.0
└── untitled-no-more@0.1.0
Ben3eeE commented 7 years ago

I accidentally reproduced this in safe mode when recording a gif and narrowing down steps for https://github.com/atom/github/issues/1142

emitter has been disposed

50Wliu commented 7 years ago

https://github.com/atom/tabs/blob/2decc68282c50ee0db70a5da3ce3f3755635d7c1/lib/layout.coffee#L32 doesn't check to see if the item is valid before passing it to itemIsAllowedInPane (unlike another call on L17). Since the error is of undefined, that means that e.target.item is undefined. The end function is called by tab-view.coffee on drag end: https://github.com/atom/tabs/blob/b959a04edc959fcaf056797216b3861ea9e155fe/lib/tab-view.coffee#L43, meaning that e is a dragend event. So I'm guessing in order for this to occur the target element being dragged (the tab) isn't associated with an item? Maybe the easiest fix is to just add an item? check, similar to the one on L17.