Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

Move createHandle’s destroy from context to a flag #391

Merged
merged 2 commits into from
Apr 30, 2018

Conversation

pottedmeat
Copy link
Contributor

Type: bug

The following has been addressed in the PR:

Description:

If the destroy function in the response object from createHandle was called in a different context than the original, destroy would be assigned to the call object and the destructor function would also be called in that context. By using a flag, we can guarantee the destructor is only called once regardless of associated context.

src/lang.ts Outdated
@@ -364,10 +364,13 @@ export function partial(targetFunction: (...args: any[]) => any, ...suppliedArgs
* @return The handle object
*/
export function createHandle(destructor: () => void): Handle {
var called = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be let?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, I've been working with dojo 1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I even had the red squiggly

@dylans dylans added this to the 2.0.0 milestone Apr 27, 2018
@dylans dylans merged commit 39a2967 into dojo:master Apr 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants