-
Notifications
You must be signed in to change notification settings - Fork 543
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
[QUESTION] SKBitmap.Decode(stream) will dispose this stream, feature or bug? #2263
Comments
Are you saying this was different in earlier versions? |
no difference compare with 2.88.0, i just feel it is not right, stream should be disposed by user like this
|
Just use using(var stream = ***)
{
var skData = SKData.Create(stream);
var bitmap = SKBitmap.Decode(skData);
//stream will not be closed here
} |
This is a really bad design choice if not a bug. |
I'll need to confirm, but I am pretty sure this is expected. The decode usually reads all the way to the end, and the stream may not always be rewindable. So there was not much point in keeping it open... However, the Stream overloads could maybe get an additional parameter to indicate whether or not to close the stream. |
@mattleibow Managing a Stream should be left up to the user, not a completely different function they call. |
I use SKBitmap.Decode(stream) to create a Bitmap, when i need continue use this stream, i found it is dispose.
Skiasharp Version: 2.88.2
The text was updated successfully, but these errors were encountered: