Skip to content
Open
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
5 changes: 3 additions & 2 deletions src/System.Windows.Forms/System/Windows/Forms/Control.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ public unsafe partial class Control :
private byte _requiredScaling;
private TRACKMOUSEEVENT _trackMouseEvent;
private LayoutEventArgs? _cachedLayoutEventArgs;
private Queue<ThreadMethodEntry>? _threadCallbackList;
// Publish the lazily initialized queue to readers that do not take the initialization lock.
private volatile Queue<ThreadMethodEntry>? _threadCallbackList;

// For keeping track of our ui state for focus and keyboard cues. Using a member
// variable here because we hit this a lot
Expand Down Expand Up @@ -3776,7 +3777,7 @@ private unsafe void WaitForWaitHandle(WaitHandle waitHandle)
throw new InvalidAsynchronousStateException(SR.ThreadNoLongerValid);
}

if (IsDisposed && _threadCallbackList is not null && _threadCallbackList.Count > 0)
if (IsDisposed && _threadCallbackList is not null)
{
lock (_threadCallbackList)
{
Expand Down
Loading