mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-13 19:37:44 +01:00
fix Addon/AgentLifyCycle unreg
(cherry picked from commit 29e1715ff589b9dddf5a747b8655ea382e08cf58)
This commit is contained in:
parent
1779d2681a
commit
f01971a7d7
4 changed files with 22 additions and 0 deletions
|
|
@ -94,6 +94,8 @@ internal unsafe class AddonLifecycle : IInternalDisposableService
|
|||
/// <param name="listener">The listener to unregister.</param>
|
||||
internal void UnregisterListener(AddonLifecycleEventListener listener)
|
||||
{
|
||||
listener.IsRequestedToClear = true;
|
||||
|
||||
if (this.isInvokingListeners)
|
||||
{
|
||||
this.framework.RunOnTick(() => this.UnregisterListenerMethod(listener));
|
||||
|
|
@ -122,6 +124,8 @@ internal unsafe class AddonLifecycle : IInternalDisposableService
|
|||
{
|
||||
foreach (var listener in globalListeners)
|
||||
{
|
||||
if (listener.IsRequestedToClear) continue;
|
||||
|
||||
try
|
||||
{
|
||||
listener.FunctionDelegate.Invoke(eventType, args);
|
||||
|
|
@ -138,6 +142,8 @@ internal unsafe class AddonLifecycle : IInternalDisposableService
|
|||
{
|
||||
foreach (var listener in addonListener)
|
||||
{
|
||||
if (listener.IsRequestedToClear) continue;
|
||||
|
||||
try
|
||||
{
|
||||
listener.FunctionDelegate.Invoke(eventType, args);
|
||||
|
|
|
|||
|
|
@ -35,4 +35,9 @@ internal class AddonLifecycleEventListener
|
|||
/// Gets the delegate this listener invokes.
|
||||
/// </summary>
|
||||
public IAddonLifecycle.AddonEventDelegate FunctionDelegate { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets if the listener is requested to be cleared.
|
||||
/// </summary>
|
||||
internal bool IsRequestedToClear { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,6 +107,8 @@ internal unsafe class AgentLifecycle : IInternalDisposableService
|
|||
/// <param name="listener">The listener to unregister.</param>
|
||||
internal void UnregisterListener(AgentLifecycleEventListener listener)
|
||||
{
|
||||
listener.IsRequestedToClear = true;
|
||||
|
||||
if (this.isInvokingListeners)
|
||||
{
|
||||
this.framework.RunOnTick(() => this.UnregisterListenerMethod(listener));
|
||||
|
|
@ -135,6 +137,8 @@ internal unsafe class AgentLifecycle : IInternalDisposableService
|
|||
{
|
||||
foreach (var listener in globalListeners)
|
||||
{
|
||||
if (listener.IsRequestedToClear) continue;
|
||||
|
||||
try
|
||||
{
|
||||
listener.FunctionDelegate.Invoke(eventType, args);
|
||||
|
|
@ -151,6 +155,8 @@ internal unsafe class AgentLifecycle : IInternalDisposableService
|
|||
{
|
||||
foreach (var listener in agentListener)
|
||||
{
|
||||
if (listener.IsRequestedToClear) continue;
|
||||
|
||||
try
|
||||
{
|
||||
listener.FunctionDelegate.Invoke(eventType, args);
|
||||
|
|
|
|||
|
|
@ -35,4 +35,9 @@ public class AgentLifecycleEventListener
|
|||
/// Gets the delegate this listener invokes.
|
||||
/// </summary>
|
||||
public IAgentLifecycle.AgentEventDelegate FunctionDelegate { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets if the listener is requested to be cleared.
|
||||
/// </summary>
|
||||
internal bool IsRequestedToClear { get; set; }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue