-
Notifications
You must be signed in to change notification settings - Fork 114
Open
Description
There are threading issues in asynchronous messaging with inactive subscription.
Namely code in Post methods checks whether subscription is active before invoking subscription method
TEventBus.Post
for LSubscription in LSubscriptions do begin
if (LSubscription.Context <> AChannel) or (not LSubscription.Active) then Continue;
PostToChannel(LSubscription, AMessage, LIsMainThread);
for LSubscription in LSubscriptions do begin
if not LSubscription.Active then Continue;
PostToSubscription(LSubscription, AEvent, LIsMainThread);
But, depending on threading mode PostToChannel and PostToSubscription methods can invoke subscription method asynchronously with TThread.Queue or TTask.Run or TThread.CreateAnonymousThread
During that time subscription can get inactive and that can cause crashes by calling subscription method on dead object.
Metadata
Metadata
Assignees
Labels
No labels