From 64412ddece9d3f717ff248dd2baa2389bacc286f Mon Sep 17 00:00:00 2001 From: Roland Bengtsson Date: Fri, 6 Dec 2024 22:40:37 +0200 Subject: [PATCH] #20 Fix in TBoldDirtyObjectTracker.DiscardChanges. --- Source/BoldSystem.pas | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/BoldSystem.pas b/Source/BoldSystem.pas index 0f53e3b..8fdf43f 100644 --- a/Source/BoldSystem.pas +++ b/Source/BoldSystem.pas @@ -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;