mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-01 05:13:40 +01:00
fix
This commit is contained in:
parent
71b84bcf40
commit
2c013f39ca
3 changed files with 7 additions and 13 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
using System.Buffers;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -54,7 +53,6 @@ internal sealed class FileSystemSharableTexture : SharableTexture
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
protected override void ReleaseResources()
|
protected override void ReleaseResources()
|
||||||
{
|
{
|
||||||
this.DisposeSuppressingWrap = null;
|
|
||||||
_ = this.UnderlyingWrap?.ToContentDisposedTask(true);
|
_ = this.UnderlyingWrap?.ToContentDisposedTask(true);
|
||||||
this.UnderlyingWrap = null;
|
this.UnderlyingWrap = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,6 @@ internal sealed class GamePathSharableTexture : SharableTexture
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
protected override void ReleaseResources()
|
protected override void ReleaseResources()
|
||||||
{
|
{
|
||||||
this.DisposeSuppressingWrap = null;
|
|
||||||
_ = this.UnderlyingWrap?.ToContentDisposedTask(true);
|
_ = this.UnderlyingWrap?.ToContentDisposedTask(true);
|
||||||
this.UnderlyingWrap = null;
|
this.UnderlyingWrap = null;
|
||||||
}
|
}
|
||||||
|
|
@ -74,8 +73,6 @@ internal sealed class GamePathSharableTexture : SharableTexture
|
||||||
if (dm.GetFile<TexFile>(this.path) is not { } file)
|
if (dm.GetFile<TexFile>(this.path) is not { } file)
|
||||||
throw new FileNotFoundException();
|
throw new FileNotFoundException();
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
var t = tm.NoThrottleGetFromTexFile(file);
|
return tm.NoThrottleGetFromTexFile(file);
|
||||||
this.DisposeSuppressingWrap = new(t);
|
|
||||||
return t;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ internal abstract class SharableTexture : IRefCountable, TextureLoadThrottler.IT
|
||||||
private long selfReferenceExpiry;
|
private long selfReferenceExpiry;
|
||||||
private IDalamudTextureWrap? availableOnAccessWrapForApi9;
|
private IDalamudTextureWrap? availableOnAccessWrapForApi9;
|
||||||
private CancellationTokenSource? cancellationTokenSource;
|
private CancellationTokenSource? cancellationTokenSource;
|
||||||
|
private DisposeSuppressingTextureWrap? disposeSuppressingWrap;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SharableTexture"/> class.
|
/// Initializes a new instance of the <see cref="SharableTexture"/> class.
|
||||||
|
|
@ -102,11 +103,6 @@ internal abstract class SharableTexture : IRefCountable, TextureLoadThrottler.IT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ContentQueried { get; private set; }
|
public bool ContentQueried { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the dispose-suppressing wrap for <see cref="UnderlyingWrap"/>.
|
|
||||||
/// </summary>
|
|
||||||
protected DisposeSuppressingTextureWrap? DisposeSuppressingWrap { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a cancellation token for cancelling load.
|
/// Gets a cancellation token for cancelling load.
|
||||||
/// Intended to be called from implementors' constructors and <see cref="ReviveResources"/>.
|
/// Intended to be called from implementors' constructors and <see cref="ReviveResources"/>.
|
||||||
|
|
@ -168,6 +164,7 @@ internal abstract class SharableTexture : IRefCountable, TextureLoadThrottler.IT
|
||||||
|
|
||||||
this.cancellationTokenSource?.Cancel();
|
this.cancellationTokenSource?.Cancel();
|
||||||
this.cancellationTokenSource = null;
|
this.cancellationTokenSource = null;
|
||||||
|
this.disposeSuppressingWrap = null;
|
||||||
this.ReleaseResources();
|
this.ReleaseResources();
|
||||||
this.resourceReleased = true;
|
this.resourceReleased = true;
|
||||||
|
|
||||||
|
|
@ -238,7 +235,9 @@ internal abstract class SharableTexture : IRefCountable, TextureLoadThrottler.IT
|
||||||
// Release the reference for rendering, after rendering ImGui.
|
// Release the reference for rendering, after rendering ImGui.
|
||||||
Service<InterfaceManager>.Get().EnqueueDeferredDispose(this);
|
Service<InterfaceManager>.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;
|
return t;
|
||||||
|
|
||||||
this.inner.UnderlyingWrap?.Wait();
|
this.inner.UnderlyingWrap?.Wait();
|
||||||
return this.inner.DisposeSuppressingWrap ?? Service<DalamudAssetManager>.Get().Empty4X4;
|
return this.inner.disposeSuppressingWrap ?? Service<DalamudAssetManager>.Get().Empty4X4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue