Skip to content

Commit

Permalink
#20 Fix in TBoldDirtyObjectTracker.DiscardChanges.
Browse files Browse the repository at this point in the history
  • Loading branch information
bero committed Dec 6, 2024
1 parent 9d1bc4a commit 64412dd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Source/BoldSystem.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1614,11 +1614,21 @@ destructor TBoldDirtyObjectTracker.Destroy;
end;

procedure TBoldDirtyObjectTracker.DiscardChanges;
var
i: integer;
BoldObject: TBoldObject;
begin
if fBoldSystem.InTransaction then
raise EBold.CreateFmt('%s.DiscardChanges: System is in transaction, discard not allowed.', [ClassName]);
while not fDirtyObjects.Empty do
(fDirtyObjects.Last as TBoldObject).Discard;
begin
i := fDirtyObjects.Count;
BoldObject := fDirtyObjects.Last;
BoldObject.Discard;
if i = fDirtyObjects.Count then
if not BoldObject.BoldDirty then
fBoldSystem.MarkObjectClean(BoldObject);
end;
end;

function TBoldDirtyObjectTracker.GetDirtyObjects: TBoldObjectList;
Expand Down

0 comments on commit 64412dd

Please sign in to comment.