Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ internal static void DetachNonPromotedObjects()
}

// Callback implementation of IFindReferenceTargetsCallback
[EagerStaticClassConstruction]
internal static unsafe class FindReferenceTargetsCallback
{
// Define an on-stack compatible COM instance to avoid allocating
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,18 @@ private IntPtr AsUserDefined(in Guid riid)

private void SetFlag(CreateComInterfaceFlagsEx flag)
{
Interlocked.Or(ref Flags, flag);
// Interlocked.Or<T>cannot be used here. It would trigger type checks that can cause
// deadlocks when called during a GC by NativeAOT TrackerObjectManager.
int setMask = (int)flag;
Interlocked.Or(ref Unsafe.As<CreateComInterfaceFlagsEx, int>(ref Flags), setMask);
}

private void ResetFlag(CreateComInterfaceFlagsEx flag)
{
Interlocked.And(ref Flags, ~flag);
// Interlocked.And<T>cannot be used here. It would trigger type checks that can cause
// deadlocks when called during a GC by NativeAOT TrackerObjectManager.
int resetMask = ~(int)flag;
Interlocked.And(ref Unsafe.As<CreateComInterfaceFlagsEx, int>(ref Flags), resetMask);
}

private static uint GetTrackerCount(ulong c)
Expand Down
Loading