View Issue Details

IDProjectCategoryView StatusLast Update
0038749pas2jsrtlpublic2021-04-13 09:07
Reporterhenrique Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformPas2JsOSWindows 
Fixed in Versiontrunk 
Summary0038749: Destruction of NestedDataSet with problems.
DescriptionI previously submitted the implementation of "NestedDataSet", but now I had a problem with destroying it. With this I am sending a fix for the problems I encountered.
TagsNo tags attached.
Fixed in Revision1142
Attached Files

Activities

henrique

2021-04-12 22:48

reporter  

0001-Ajustado-destrui-o-do-NestedDataSet.patch (1,390 bytes)   
From 33b7c0672323e7ae317b3a3f25d255c62a0c7038 Mon Sep 17 00:00:00 2001
From: Henrique Gottardi Werlang <henriquewerlang@hotmail.com>
Date: Mon, 12 Apr 2021 17:24:16 -0300
Subject: [PATCH] =?UTF-8?q?Ajustado=20destrui=C3=A7=C3=A3o=20do=20NestedDa?=
 =?UTF-8?q?taSet.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 packages/fcl-db/db.pas | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/packages/fcl-db/db.pas b/packages/fcl-db/db.pas
index ba710e67..1373c344 100644
--- a/packages/fcl-db/db.pas
+++ b/packages/fcl-db/db.pas
@@ -736,6 +736,8 @@ type
     procedure Bind(Binding: Boolean); override;
   public
     constructor Create(AOwner: TComponent); override;
+
+    destructor Destroy; override;
   end;
 
 { TIndexDef }
@@ -2371,6 +2373,9 @@ var
 
 begin
   Active:=False;
+
+  SetDataSetField(nil);
+
   FFieldDefs.Free;
   FFieldList.Free;
   FNestedDataSets.Free;
@@ -9120,14 +9125,18 @@ begin
     if Assigned(DataSet) then
       DataSet.NestedDataSets.Remove(FNestedDataSet);
   end;
+
   if Assigned(Value) then
-  begin
     DataSet.NestedDataSets.Add(Value);
-    FFields := Value.Fields;
-  end
-  else
-    FFields := nil;
+
   FNestedDataSet := Value;
 end;
 
+destructor TDataSetField.Destroy;
+begin
+  AssignNestedDataSet(nil);
+
+  inherited;
+end;
+
 end.
-- 
2.31.1.windows.1

Issue History

Date Modified Username Field Change
2021-04-12 22:48 henrique New Issue
2021-04-12 22:48 henrique File Added: 0001-Ajustado-destrui-o-do-NestedDataSet.patch
2021-04-13 09:07 Michael Van Canneyt Assigned To => Michael Van Canneyt
2021-04-13 09:07 Michael Van Canneyt Status new => resolved
2021-04-13 09:07 Michael Van Canneyt Resolution open => fixed
2021-04-13 09:07 Michael Van Canneyt Fixed in Version => trunk
2021-04-13 09:07 Michael Van Canneyt Fixed in Revision => 1142