Merge pull request #2548 from Soreepeong/fix/sta-cts
Some checks failed
Tag Build / Tag Build (push) Successful in 4s
Build Dalamud / Build on Windows (push) Has been cancelled
Build Dalamud / Check API Compatibility (push) Has been cancelled
Build Dalamud / Deploy dalamud-distrib staging (push) Has been cancelled

Fix wrong CancellationToken usage
This commit is contained in:
goat 2025-12-22 10:56:59 +01:00 committed by GitHub
commit 3be14d4135
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -113,7 +113,7 @@ internal partial class StaThreadService : IInternalDisposableService
using var cts = CancellationTokenSource.CreateLinkedTokenSource(
this.cancellationTokenSource.Token,
cancellationToken);
await this.taskFactory.StartNew(action, cancellationToken).ConfigureAwait(true);
await this.taskFactory.StartNew(action, cts.Token).ConfigureAwait(true);
}
/// <summary>Runs a given delegate in the messaging thread.</summary>
@ -126,7 +126,7 @@ internal partial class StaThreadService : IInternalDisposableService
using var cts = CancellationTokenSource.CreateLinkedTokenSource(
this.cancellationTokenSource.Token,
cancellationToken);
return await this.taskFactory.StartNew(func, cancellationToken).ConfigureAwait(true);
return await this.taskFactory.StartNew(func, cts.Token).ConfigureAwait(true);
}
/// <summary>Runs a given delegate in the messaging thread.</summary>
@ -138,7 +138,7 @@ internal partial class StaThreadService : IInternalDisposableService
using var cts = CancellationTokenSource.CreateLinkedTokenSource(
this.cancellationTokenSource.Token,
cancellationToken);
await await this.taskFactory.StartNew(func, cancellationToken).ConfigureAwait(true);
await await this.taskFactory.StartNew(func, cts.Token).ConfigureAwait(true);
}
/// <summary>Runs a given delegate in the messaging thread.</summary>
@ -151,7 +151,7 @@ internal partial class StaThreadService : IInternalDisposableService
using var cts = CancellationTokenSource.CreateLinkedTokenSource(
this.cancellationTokenSource.Token,
cancellationToken);
return await await this.taskFactory.StartNew(func, cancellationToken).ConfigureAwait(true);
return await await this.taskFactory.StartNew(func, cts.Token).ConfigureAwait(true);
}
[LibraryImport("ole32.dll")]