From 558ff99b08d9a316b8a3f6502b0dc465677a9b16 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Sun, 10 Apr 2022 09:42:48 +0100 Subject: [PATCH] revert Frame Dispose --- .../Formats/Jpeg/JpegDecoderCore.cs | 35 ++++++++----------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs index a4b42b994..ef4e3ffac 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs @@ -187,27 +187,20 @@ namespace SixLabors.ImageSharp.Formats.Jpeg where TPixel : unmanaged, IPixel { using var spectralConverter = new SpectralConverter(this.Configuration); - try - { - var scanDecoder = new HuffmanScanDecoder(stream, spectralConverter, cancellationToken); - - this.ParseStream(stream, scanDecoder, cancellationToken); - this.InitExifProfile(); - this.InitIccProfile(); - this.InitIptcProfile(); - this.InitXmpProfile(); - this.InitDerivedMetadataProperties(); - - return new Image( - this.Configuration, - spectralConverter.GetPixelBuffer(cancellationToken), - this.Metadata); - } - catch - { - this.Frame?.Dispose(); - throw; - } + + var scanDecoder = new HuffmanScanDecoder(stream, spectralConverter, cancellationToken); + + this.ParseStream(stream, scanDecoder, cancellationToken); + this.InitExifProfile(); + this.InitIccProfile(); + this.InitIptcProfile(); + this.InitXmpProfile(); + this.InitDerivedMetadataProperties(); + + return new Image( + this.Configuration, + spectralConverter.GetPixelBuffer(cancellationToken), + this.Metadata); } ///