-
Notifications
You must be signed in to change notification settings - Fork 12
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
SimpleDragHandler dispose may be incomplete #725
Comments
@jonathanolson replied:
Presumably if there's a chance of dispose() being called during a drag, we COULD add interrupt() to the dispose()? It feels slightly unclean to DO things other than dispose during a dispose call, and I'd consider requiring clients to make sure they don't dispose something while dragging. As for the unchanged variables on the SimpleDragHandler, it shouldn't matter. If you dispose it, you shouldn't be accessing it afterwards or assuming things about its state. So I can:
It should be permitted to call |
I would anticipate that (1) is going to break some existing code, since you're adding a brand new requirement. If you go with (2), you'll need to do more than just call |
Regardless of which option you go with... SimpleDragHandler needs a callback for |
Unassigning until we hear from @jonathanolson. |
That seems incorrect. Not only is the dragHandler.interrupted set to true, but the end callback WOULD be fired (as that's kind of the purpose of interrupt). If you just care if the drag ends, use end. If you care if it's interrupted, check the If people would prefer me to also add
Yes. If we go that route, presumably I'd run aqua testing and handle refactoring for all cases where it would break. |
@jonathanolson said:
Confirmed what you said by reading the code. This was a case of me not understanding the semantics of "end", since it's not clearly documented anywhere. Apparently it's called by interrupt, but not called (for some reason) by cancel.
No visibility annotations in SimpleDragHandler, so I assumed that
Based on your clarification, I don't think that's necessary. What I do think is necessary is documentation. For example, I still don't know when it's appropriate to use |
I'll work at improving documentation in SimpleDragHandler to clarify everything. For reference, |
Not sure how to help, unassigning for now but please reassign me if you need me. |
It seems like dispose() in the current version looks pretty complete. The only change I could imagine would be interrupting the listener in the disposal, but it still sounds weird. @samreid should we discuss changes to the current SimpleDragHandler? |
That looks like it has since been annotated.
Adding It also appears this issue was sparked by a comment from @pixelzoom in phetsims/equality-explorer#25 (comment) -- @pixelzoom what else do you think remains for this issue? |
Calling I can't tell what in phetsims/equality-explorer#25 (comment) was or was not addressed, so I have no idea if there's anything remaining to do here. |
@jonathanolson do you think this issue can be closed? |
This looks complete to me, closing. |
In phetsims/equality-explorer#25 (comment) @pixelzoom said:
@samreid said:
@jonathanolson can you comment on why
dispose
does only some of the "cleanup" things that normally occur inendDrag
? Ifdispose
is called during a drag cycle,this.dragging
remainstrue
, the client'soptions.end
callback is never called, andthis.pointer
still holds a reference to the pointer.This has nothing to do with sim-specific code and is blocking my ability to fuzz test. So I commented out the failing assertion in the above commit.
@samreid @jonathanolson There appear to be 2 problems here:
(1)
startEvent
/endEvent
pairing is not considering the possibility of an interrupted drag cycle.(2) The cleanup done by SimpleDragHandler
dispose
appears to be incomplete, when compared withendDrag
.The text was updated successfully, but these errors were encountered: