fix: Adds dispose call to LibDeflateBinding on process exits (#1784)

This commit is contained in:
Stefano Merotta 2024-05-21 22:40:03 +02:00 • committed by GitHub
parent 00908d030f
commit 50d3779d9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 4 deletions

View file

@ -1,4 +1,4 @@
/*************************************************************************
/*************************************************************************
* ModernUO *
* Copyright 2019-2024 - ModernUO Development Team *
* Email: hi@modernuo.com *
@ -13,11 +13,23 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*************************************************************************/
using System;
using System.IO.Compression;
namespace Server.Compression;
public static class Deflate
{
public static LibDeflateBinding Standard { get; } = new();
public static LibDeflateBinding Standard { get; }
static Deflate()
{
Standard = new LibDeflateBinding();
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
}
private static void CurrentDomain_ProcessExit(object sender, EventArgs e)
{
Standard.Dispose();
}
}