Skip to content

Commit 4b0be02

Browse files
committed
Improved docs for IDispatcherQueueHandler.Release() call
1 parent 972402d commit 4b0be02

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CommunityToolkit.WinUI/Extensions/DispatcherQueueExtensions{T}.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ private static unsafe bool TryEnqueue<THandler>(DispatcherQueue dispatcherQueue,
134134
}
135135
finally
136136
{
137+
// This call doesn not have a corresponding AddRef() invocation that is visible, and
138+
// that is because the static constructors for all existing custom handlers already
139+
// set the internal reference count to 1. Structuring the code like this makes it
140+
// possible to centralize all logic in this method without each caller needing to
141+
// explicitly have a try/finally block for the allocated handler that is passed here.
137142
dispatcherQueueHandler->Release();
138143
}
139144

0 commit comments

Comments
 (0)