mirror of
https://github.com/kwsch/pk3DS.git
synced 2026-10-21 23:11:04 -05:00
Fix MemoryStream disposing
BinaryWriters automatically dispose the MemoryStream it is using when the BinaryWriter is disposed of; the fix is to Flush instead of Dispose when finished (and let the GC handle disposing when it is appropriate to do so).
This commit is contained in:
@@ -438,8 +438,9 @@ internal static int write16BitColorPalette(Bitmap img, ref MemoryStream ms)
|
||||
}
|
||||
internal static void writeGeneric(int format, Bitmap img, ref MemoryStream ms, bool rectangle = true)
|
||||
{
|
||||
using (BinaryWriter bz = new BinaryWriter(ms))
|
||||
bz.Write(getPixelData(img, format, rectangle));
|
||||
BinaryWriter bz = new BinaryWriter(ms);
|
||||
bz.Write(getPixelData(img, format, rectangle));
|
||||
bz.Flush();
|
||||
}
|
||||
|
||||
internal static byte[] getPixelData(Bitmap img, int format, bool rectangle = true)
|
||||
|
||||
Reference in New Issue
Block a user