From 4bae98813bba2c0252287391d9f5774d41a53b10 Mon Sep 17 00:00:00 2001 From: VaDiM Date: Thu, 13 Apr 2023 19:51:57 +0300 Subject: [PATCH] [GUI] One more bugfix - bugfix for https://github.com/aelurum/AssetStudio/commit/44a1240f5fd4bc404173c34fe0c02796e527d595 --- AssetStudioGUI/DirectBitmap.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/AssetStudioGUI/DirectBitmap.cs b/AssetStudioGUI/DirectBitmap.cs index 3d55767..459fee6 100644 --- a/AssetStudioGUI/DirectBitmap.cs +++ b/AssetStudioGUI/DirectBitmap.cs @@ -14,12 +14,10 @@ namespace AssetStudioGUI { Width = image.Width; Height = image.Height; - var buff = BigArrayPool.Shared.Rent(Width * Height * 4); - image.CopyPixelDataTo(buff); - Bits = buff; + Bits = BigArrayPool.Shared.Rent(Width * Height * 4); + image.CopyPixelDataTo(Bits); m_handle = GCHandle.Alloc(Bits, GCHandleType.Pinned); m_bitmap = new Bitmap(Width, Height, Stride, PixelFormat.Format32bppArgb, m_handle.AddrOfPinnedObject()); - BigArrayPool.Shared.Return(buff); } private void Dispose(bool disposing) @@ -28,6 +26,7 @@ namespace AssetStudioGUI { m_bitmap.Dispose(); m_handle.Free(); + BigArrayPool.Shared.Return(Bits); } m_bitmap = null; }