mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
parent
4f68809ab0
commit
1f0b616e2c
3 changed files with 17 additions and 5 deletions
|
|
@ -134,6 +134,9 @@ internal unsafe class AddonLifecycle : IInternalDisposableService
|
|||
/// <param name="listener">The listener to unregister.</param>
|
||||
internal void UnregisterListener(AddonLifecycleEventListener listener)
|
||||
{
|
||||
// Set removed state to true immediately, then lazily remove it from the EventListeners list on next Framework Update.
|
||||
listener.Removed = true;
|
||||
|
||||
this.framework.RunOnTick(() =>
|
||||
{
|
||||
this.EventListeners.Remove(listener);
|
||||
|
|
@ -168,6 +171,10 @@ internal unsafe class AddonLifecycle : IInternalDisposableService
|
|||
if (listener.EventType != eventType)
|
||||
continue;
|
||||
|
||||
// If the listener is pending removal, and is waiting until the next Framework Update, don't invoke listener.
|
||||
if (listener.Removed)
|
||||
continue;
|
||||
|
||||
// Match on string.empty for listeners that want events for all addons.
|
||||
if (!string.IsNullOrWhiteSpace(listener.AddonName) && !args.IsAddon(listener.AddonName))
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@ internal class AddonLifecycleEventListener
|
|||
/// </summary>
|
||||
public string AddonName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this event has been unregistered.
|
||||
/// </summary>
|
||||
public bool Removed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the event type this listener is looking for.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public sealed unsafe class DtrBarEntry : IDisposable, IDtrBarEntry
|
|||
private readonly DalamudConfiguration configuration;
|
||||
|
||||
private bool shownBacking = true;
|
||||
private SeString? textBacking = null;
|
||||
private SeString? textBacking;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DtrBarEntry"/> class.
|
||||
|
|
@ -153,18 +153,18 @@ public sealed unsafe class DtrBarEntry : IDisposable, IDtrBarEntry
|
|||
/// <summary>
|
||||
/// Gets a value indicating whether this entry should be removed.
|
||||
/// </summary>
|
||||
internal bool ShouldBeRemoved { get; private set; } = false;
|
||||
internal bool ShouldBeRemoved { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this entry is dirty.
|
||||
/// </summary>
|
||||
internal bool Dirty { get; set; } = false;
|
||||
internal bool Dirty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this entry has just been added.
|
||||
/// </summary>
|
||||
internal bool Added { get; set; } = false;
|
||||
|
||||
internal bool Added { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool TriggerClickAction()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue