Skip to content

Commit 8bc5b58

Browse files
committed
Fixed deadlock scenario caused by unsubscribing during an event.
1 parent 0afc9bf commit 8bc5b58

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/EventService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public FluentResults.Result Subscribe<T>(T subscriber) where T : class, IEvent<T
264264
public void Unsubscribe<T>(T subscriber) where T : class, IEvent
265265
{
266266
Guard.IsNotNull(subscriber, nameof(subscriber));
267-
using var lck = _operationsLock.AcquireWriterLock().ConfigureAwait(false).GetAwaiter().GetResult();
267+
using var lck = _operationsLock.AcquireReaderLock().ConfigureAwait(false).GetAwaiter().GetResult();
268268
IService.CheckDisposed(this);
269269

270270
if (!_subscribers.TryGetValue(typeof(T), out var evtSubscribers))

0 commit comments

Comments
 (0)