Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid accessing destroyed contexts in loop #55

Merged
merged 5 commits into from
Sep 1, 2014

Conversation

mmikeyy
Copy link
Contributor

@mmikeyy mmikeyy commented Aug 28, 2014

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.

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
Copy link
Contributor

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?

to ensure that when contexts are all processed in sequence to trigger the event on each one, the destruction of a yet unprocessed context does not cause the program to attempt to trigger the event on it (as it no longer exists...) when the loop reaches it
geekdave added a commit that referenced this pull request Sep 1, 2014
Avoid accessing destroyed contexts in loop
@geekdave geekdave merged commit 79e3c31 into GeppettoJS:master Sep 1, 2014
@geekdave
Copy link
Contributor

geekdave commented Sep 1, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants