Add ClientStatePluginScoped (#1384)

* Add ClientStatePluginScoped

* Restore InvokeSafely

* Add InvokeSafely for basic Action types.

* Set delegates to null to prevent leaking memory

* Resolve Merge
This commit is contained in:
MidoriKami 2023-09-21 21:55:16 -07:00 committed by GitHub
parent 201a927952
commit b742abe77f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 165 additions and 37 deletions

View file

@ -44,7 +44,7 @@ internal class NetworkHandlers : IDisposable, IServiceType
private NetworkHandlers(GameNetwork gameNetwork)
{
this.uploader = new UniversalisMarketBoardUploader();
this.CfPop = (_, _) => { };
this.CfPop = _ => { };
this.messages = Observable.Create<NetworkMessage>(observer =>
{
@ -75,7 +75,7 @@ internal class NetworkHandlers : IDisposable, IServiceType
/// <summary>
/// Event which gets fired when a duty is ready.
/// </summary>
public event EventHandler<ContentFinderCondition> CfPop;
public event Action<ContentFinderCondition> CfPop;
/// <summary>
/// Disposes of managed and unmanaged resources.
@ -430,7 +430,7 @@ internal class NetworkHandlers : IDisposable, IServiceType
Service<ChatGui>.GetNullable()?.Print($"Duty pop: {cfcName}");
}
this.CfPop.InvokeSafely(this, cfCondition);
this.CfPop.InvokeSafely(cfCondition);
}).ContinueWith(
task => Log.Error(task.Exception, "CfPop.Invoke failed"),
TaskContinuationOptions.OnlyOnFaulted);