adobe-photoshop / spaces-design

Adobe Photoshop Design Space
http://adobe-photoshop.github.io/
Other
852 stars 74 forks source link

Closing files rapidly in succession will cause an error #3678

Closed ktaki closed 8 years ago

ktaki commented 8 years ago

Action documents.close failed: TypeError: Cannot read property 'id' of null

The error can be seen closing large documents in succession by repeated Cmd/Ctrl-w, but easiest method for reproducing this error is the following.

  1. Create two new documents by Cmd/Ctrl-n
  2. Closing the two files by keep pressing Cmd/Ctrl-w

screen shot 2016-02-05 at 11 05 40 am

Note: A similar issue was reported and fixed in the issue #1813.

chadrolfs commented 8 years ago

I ran into this once yesterday but cnr on subsequent attempts. Thanks for tracking this down.

iwehrman commented 8 years ago

I can repro. The problem is that the action assumes that a valid document model exists because the menu command is supposed to be disabled when that isn't the case. But the menu is not rebuilt for a few hundred milliseconds after the models are updated so that updates can be grouped, thus reducing unnecessary work. As a result, the File > Close command is enabled when it shouldn't be after the last document is closed, and so the user is allowed to execute a documents.close action in a state that violates that action's precondition. Simple fix coming right up...

baaygun commented 8 years ago

FBNC to @ktaki

ktaki commented 8 years ago

Verified the fix.