mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-18 05:47:43 +01:00
[AddonEventManager] Actually Ensure Thread Safety (#1589)
* Actually make AddonEventManager thread safe * Ensure AddonEventHandlers are also thread safe Additionally, use Guid instead of strings * Make DalamudInternalKey readonly * Properly use ConcurrentDict features Fixes GUID not working
This commit is contained in:
parent
a6b802b577
commit
02b1f6e426
3 changed files with 43 additions and 58 deletions
|
|
@ -19,19 +19,11 @@ internal unsafe class PluginEventController : IDisposable
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PluginEventController"/> class.
|
||||
/// </summary>
|
||||
/// <param name="pluginId">The Unique ID for this plugin.</param>
|
||||
public PluginEventController(string pluginId)
|
||||
public PluginEventController()
|
||||
{
|
||||
this.PluginId = pluginId;
|
||||
|
||||
this.EventListener = new AddonEventListener(this.PluginEventListHandler);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique ID for this PluginEventList.
|
||||
/// </summary>
|
||||
public string PluginId { get; init; }
|
||||
|
||||
private AddonEventListener EventListener { get; init; }
|
||||
|
||||
private List<AddonEventEntry> Events { get; } = new();
|
||||
|
|
@ -125,7 +117,7 @@ internal unsafe class PluginEventController : IDisposable
|
|||
if (this.Events.All(registeredEvent => registeredEvent.ParamKey != i)) return i;
|
||||
}
|
||||
|
||||
throw new OverflowException($"uint.MaxValue number of ParamKeys used for {this.PluginId}");
|
||||
throw new OverflowException($"uint.MaxValue number of ParamKeys used for this event controller.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue