-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix leak of callbacks on canceled requests.
We clear mErrorListener on cancel(), and mListener in all Request subclasses in the toolbox package, and synchronize all reads/writes of these fields. This ensures that we don't hold a reference to the listeners after a request is canceled. Custom subclasses of Request will need to do the same if they are concerned about this leak (which only lasts as long as the network request takes, in the worst case). Also fix some lingering thread-safety issues for any variable in Request which can be mutated during the processing of a request and which is read from multiple threads. This provides a somewhat stronger guarantee around callback invocation after cancel than we previously had (although a weaker one than we incorrectly advertised) - after calling cancel(), we won't deliver the callback as long as either cancel() was called on the same thread as the ResponseDelivery being used or if the Request subclass handles clearing its listener on cancel() correctly. Fixes #15
- Loading branch information
Showing
5 changed files
with
115 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95f64de
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"May the Force be with you" to add one more version of release after having enough of snapshots.
95f64de
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1