GeppettoJS / backbone.geppetto

Bring your Backbone applications to life with an event-driven Command framework.
http://geppettojs.github.com/backbone.geppetto/
MIT License
203 stars 28 forks source link

Avoid accessing destroyed contexts in loop #55

Closed mmikeyy closed 10 years ago

mmikeyy commented 10 years ago

Dispatch globally can cause certain events to close a view with bound context. This causes the destruction of the bound context. If this context has not yet been reached by the _.each loop that triggers the event on all contexts, an attempt will later be made to execute "context.vent.trigger" on a destroyed view and all further processing will abort on a "trying to access vent of undefined" error for that view.

geekdave commented 10 years ago

In this case, the build is failing due to our militant code coverage requirements:

FAIL [ 97% < 98% ] : ./../backbone.geppetto.js (224 / 229)

Would it be possible to add a test which hits the new lines you added, and verifies the new condition?

geekdave commented 10 years ago

You're rockin' these PRs, @mmikeyy ! Thanks for finding and fixing these edge cases!