Remove unnecessary CanvasEffect.lockObject field

このコミットが含まれているのは:
Sergio Pedri committed 2023-04-30 16:02:31 +02:00
1 親 3fdd315d88
コミット 0f1e6dc11a
2ファイル変更
+3 -8

検索条件に一致するファイルはありません

+1 -1
ファイルの表示
@@ -69,7 +69,7 @@ unsafe partial class CanvasEffect
[MemberNotNull(nameof(canvasImage))]
private ICanvasImage GetCanvasImage()
{
lock (this.lockObject)
lock (this.transformNodes)
{
default(ObjectDisposedException).ThrowIf(this.isDisposed, this);
+2 -7
ファイルの表示
@@ -15,11 +15,6 @@ namespace ComputeSharp.D2D1.WinUI;
/// </summary>
public abstract partial class CanvasEffect : ICanvasImage, ICanvasImageInterop.Interface
{
/// <summary>
/// Lock object used to synchronize calls to <see cref="ICanvasImageInterop"/> APIs.
/// </summary>
private readonly object lockObject = new();
/// <summary>
/// The mapping of registered transform nodes for the current effect graph.
/// </summary>
@@ -137,7 +132,7 @@ public abstract partial class CanvasEffect : ICanvasImage, ICanvasImageInterop.I
/// </remarks>
protected void InvalidateEffectGraph(InvalidationType invalidationType = InvalidationType.Update)
{
lock (this.lockObject)
lock (this.transformNodes)
{
// If the effect graph should be created again, dispose the image and throw it away
if (invalidationType == InvalidationType.Creation)
@@ -212,7 +207,7 @@ public abstract partial class CanvasEffect : ICanvasImage, ICanvasImageInterop.I
// the lock itself might have already been collected by the time this code runs, which would lead the lock
// statement to throw a NullReferenceException. So if a finalizer is running, just let objects be collected
// on their own. This is fine here since there are no unmanaged references to free, but just managed wrappers.
lock (this.lockObject)
lock (this.transformNodes)
{
DisposeEffectGraph();
}