-
-
Notifications
You must be signed in to change notification settings - Fork 22
fix: Close streams to be able to delete cache folder #70
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
Open
hoo-dles
wants to merge
3
commits into
ReVanced:dev
Choose a base branch
from
hoo-dles:fix/hanging-dex-streams
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This works, however now you can't call this function twice. I remember functions should "always be callable multiple times"
Uh oh!
There was an error while loading. Please reload this page.
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.
Is it maybe possible to pass a handle to manually open and close a stream in patcher? Not a file handle though as we'd need to expose the "File" API when patcher should just contract with a generic handle instead
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.
To my knowledge, a
File
object is the lowest/generic way to construct a stream from a local file. Once a stream is closed, the data stream no longer exists and you can't re-open or close it at will.This is pretty much why I advocated to pass around a file descriptor instead of a potentially closed stream.
Uh oh!
There was an error while loading. Please reload this page.
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.
The most abstract is a Handle interface with a method to open a stream to be implemented by patcher. Not a File object
Uh oh!
There was an error while loading. Please reload this page.
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.
I already explained why File won't work. The fact that patcher is using a File under the hood is private and scoped to patchers internals. I may very much swap it with an in memory implementation. The second i expose the File API, it is part of the public API and I can't do that no more. Right now patcher provides a dexFile.stream directly, but instead it can provide a handle to open a stream.
e.g:
h = result.dexHandle
stream = openStream(h)
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.
You're the maintainer, so up to you. Feel free the close the PR
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.
To pass a handle, patcher API needs to change to return an interface where you can call inputStream(). Patcher then can handle the implementation for it respectively for the internal implementation. For File ill open a file inputstream, for byte[] it'll wrap to a bytearray input stream. Any amount of streams can be opened and closed solving the issue in this comment. Could you PR that? Since the API changes, you may need to deprecate the old API