Skip to content

Commit

Permalink
Iterate over copy of list for increased thread-safety
Browse files Browse the repository at this point in the history
  • Loading branch information
tmct authored Jan 30, 2025
1 parent 1a6ff0f commit 11400a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/log4net/Util/AppenderAttachedImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public void RemoveAllAppenders()
{
if (_appenderList is not null)
{
foreach (IAppender appender in _appenderList)
foreach (IAppender appender in _appenderList.ToArray())
{
try
{
Expand Down Expand Up @@ -320,4 +320,4 @@ public void RemoveAllAppenders()
/// log message.
/// </remarks>
private static readonly Type _declaringType = typeof(AppenderAttachedImpl);
}
}

0 comments on commit 11400a1

Please sign in to comment.