Skip to content

Commit

Permalink
Remove finalizer in EventManager and transfer finalizing responsabili…
Browse files Browse the repository at this point in the history
…ty to AutoPurger
  • Loading branch information
Enderlook committed May 22, 2022
1 parent b260ef1 commit 52934d9
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Improve internal array pool sharing (reduces memory consumption and allocation) in .NET >= 5.
- Remove dependencies in .NET >= 5.
- Replace `System.Buffers` and `System.Runtime.CompilerServices.Unsafe` for `System.Memory` dependency in .NET < 5.
- Remove finalizer in `EventManager`.

## 0.4.1

Expand Down
2 changes: 1 addition & 1 deletion Enderlook.EventManager/Enderlook.EventManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Product>Enderlook.EventManager</Product>
<RepositoryUrl>https://github.com/Enderlook/Net-Event-Manager</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>0.4.1</Version>
<Version>0.4.2</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<LangVersion>10</LangVersion>
Expand Down
3 changes: 3 additions & 0 deletions Enderlook.EventManager/src/EventManager.AutoPurger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ private sealed class AutoPurger
if (manager.ConcurrentPurge())
GC.ReRegisterForFinalize(this);
else
{
manager.Dispose();
handle.Free();
}
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions Enderlook.EventManager/src/EventManager.Dispose.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public void Dispose()
return;
}

GC.SuppressFinalize(this);

Lock(ref stateLock);
{
state = IS_DISPOSED_OR_DISPOSING;
Expand Down
5 changes: 0 additions & 5 deletions Enderlook.EventManager/src/EventManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ public sealed partial class EventManager : IDisposable
/// </summary>
public static EventManager Shared { get; } = new EventManager();

/// <summary>
/// Automatically disposes the object in case it wasn't disposed by the user.
/// </summary>
~EventManager() => Dispose();

/// <summary>
/// Raises an event type <typeparamref name="TEvent"/>.<br/>
/// Execution order of subscribed delegates is undefined.
Expand Down

0 comments on commit 52934d9

Please sign in to comment.