Spring.Events.Base missing reset of fCount in method clear;

Issue #277 duplicate
Friedrich Westermann created an issue

There is a problem with the clear Method If you call for example OnChanged.Clear; with existing handlers the release of the List will fail, because the Count is on a wrong value. found it in the ORMTests -> TestObjectDataSet -> Delete_Notification;

procedure TEventBase.Clear;
var
  i: Integer;
begin
  LockEnter;
  try
    for i := 0 to Count - 1 do
      Notify(Self, fHandlers[i], cnRemoved);
    fHandlers := nil;
    fCount := 0; // Should be added
  finally
    LockLeave;
  end;
end;

Comments (4)

  1. Log in to comment