diff --git a/Dalamud/Interface/Internal/SharableTextures/FileSystemSharableTexture.cs b/Dalamud/Interface/Internal/SharableTextures/FileSystemSharableTexture.cs
index fe1b16de8..df4d2ca0a 100644
--- a/Dalamud/Interface/Internal/SharableTextures/FileSystemSharableTexture.cs
+++ b/Dalamud/Interface/Internal/SharableTextures/FileSystemSharableTexture.cs
@@ -1,4 +1,3 @@
-using System.Buffers;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
@@ -54,7 +53,6 @@ internal sealed class FileSystemSharableTexture : SharableTexture
///
protected override void ReleaseResources()
{
- this.DisposeSuppressingWrap = null;
_ = this.UnderlyingWrap?.ToContentDisposedTask(true);
this.UnderlyingWrap = null;
}
diff --git a/Dalamud/Interface/Internal/SharableTextures/GamePathSharableTexture.cs b/Dalamud/Interface/Internal/SharableTextures/GamePathSharableTexture.cs
index d7c478187..db51159bb 100644
--- a/Dalamud/Interface/Internal/SharableTextures/GamePathSharableTexture.cs
+++ b/Dalamud/Interface/Internal/SharableTextures/GamePathSharableTexture.cs
@@ -55,7 +55,6 @@ internal sealed class GamePathSharableTexture : SharableTexture
///
protected override void ReleaseResources()
{
- this.DisposeSuppressingWrap = null;
_ = this.UnderlyingWrap?.ToContentDisposedTask(true);
this.UnderlyingWrap = null;
}
@@ -74,8 +73,6 @@ internal sealed class GamePathSharableTexture : SharableTexture
if (dm.GetFile(this.path) is not { } file)
throw new FileNotFoundException();
cancellationToken.ThrowIfCancellationRequested();
- var t = tm.NoThrottleGetFromTexFile(file);
- this.DisposeSuppressingWrap = new(t);
- return t;
+ return tm.NoThrottleGetFromTexFile(file);
}
}
diff --git a/Dalamud/Interface/Internal/SharableTextures/SharableTexture.cs b/Dalamud/Interface/Internal/SharableTextures/SharableTexture.cs
index 0bdd4ed4a..cb12c1894 100644
--- a/Dalamud/Interface/Internal/SharableTextures/SharableTexture.cs
+++ b/Dalamud/Interface/Internal/SharableTextures/SharableTexture.cs
@@ -23,6 +23,7 @@ internal abstract class SharableTexture : IRefCountable, TextureLoadThrottler.IT
private long selfReferenceExpiry;
private IDalamudTextureWrap? availableOnAccessWrapForApi9;
private CancellationTokenSource? cancellationTokenSource;
+ private DisposeSuppressingTextureWrap? disposeSuppressingWrap;
///
/// Initializes a new instance of the class.
@@ -102,11 +103,6 @@ internal abstract class SharableTexture : IRefCountable, TextureLoadThrottler.IT
///
public bool ContentQueried { get; private set; }
- ///
- /// Gets or sets the dispose-suppressing wrap for .
- ///
- protected DisposeSuppressingTextureWrap? DisposeSuppressingWrap { get; set; }
-
///
/// Gets a cancellation token for cancelling load.
/// Intended to be called from implementors' constructors and .
@@ -168,6 +164,7 @@ internal abstract class SharableTexture : IRefCountable, TextureLoadThrottler.IT
this.cancellationTokenSource?.Cancel();
this.cancellationTokenSource = null;
+ this.disposeSuppressingWrap = null;
this.ReleaseResources();
this.resourceReleased = true;
@@ -238,7 +235,9 @@ internal abstract class SharableTexture : IRefCountable, TextureLoadThrottler.IT
// Release the reference for rendering, after rendering ImGui.
Service.Get().EnqueueDeferredDispose(this);
- return this.DisposeSuppressingWrap;
+ return this.UnderlyingWrap?.IsCompletedSuccessfully is true
+ ? this.disposeSuppressingWrap ??= new(this.UnderlyingWrap.Result)
+ : null;
}
}
@@ -458,7 +457,7 @@ internal abstract class SharableTexture : IRefCountable, TextureLoadThrottler.IT
return t;
this.inner.UnderlyingWrap?.Wait();
- return this.inner.DisposeSuppressingWrap ?? Service.Get().Empty4X4;
+ return this.inner.disposeSuppressingWrap ?? Service.Get().Empty4X4;
}
}
}