Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

fix(infra): prevent potential multi-threading issues when invoking event handlers

Lars9572ac92e511
diff --git a/LarsWM.Infrastructure/Bussing/Bus.cs b/LarsWM.Infrastructure/Bussing/Bus.cs
index 2d59b199..72cd1e97 100644
--- a/LarsWM.Infrastructure/Bussing/Bus.cs
+++ b/LarsWM.Infrastructure/Bussing/Bus.cs
@@ -74,7 +74,10 @@ namespace LarsWM.Infrastructure.Bussing
foreach (var handler in handlersToCall)
{
IEventHandler<T> handlerInstance = ServiceLocator.Provider.GetService(handler) as IEventHandler<T>;
- handlerInstance.Handle(@event);
+ lock (_lockObj)
+ {
+ handlerInstance.Handle(@event);
+ }
}
// Emit event through subject.