Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bug in TOmniValueQueue #198

Open
TommiPrami opened this issue Jul 1, 2024 · 1 comment
Open

Bug in TOmniValueQueue #198

TommiPrami opened this issue Jul 1, 2024 · 1 comment

Comments

@TommiPrami
Copy link

Code is:

procedure TOmniValueQueue.DoWithCritSec(Proc: TProc);
var
  PickUp: TInterestSet;
begin
  EnterCriticalSection;
  try
    FNotifiableEvents := [];
    Proc;
    PickUp := FNotifiableEvents;
    FNotifiableEvents := []
  finally EnterCriticalSection; end;
  PropagateNotifications(PickUp);
end; { TOmniValueQueue.DoWithCritSec }

I think it should be

procedure TOmniValueQueue.DoWithCritSec(Proc: TProc);
var
  PickUp: TInterestSet;
begin
  EnterCriticalSection;
  try
    FNotifiableEvents := [];
    Proc;
    PickUp := FNotifiableEvents;
    FNotifiableEvents := []
  finally LeaveCriticalSection; end; // <- HEre should leave the critical section
  PropagateNotifications(PickUp);
end; { TOmniValueQueue.DoWithCritSec }
@vincentparrett
Copy link
Contributor

Yeah looks like a pretty obvious bug, you should submit a pull request.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants