Page 1 of 1

[patch done] fix destroy forTZSQLStrings in latest FPC 2.7

Posted: 23.02.2012, 19:25
by alexs
this patch fix error on destroy any zeos components.
It's fix mistake - use destroyed fields.

Posted: 24.02.2012, 19:31
by EgonHugeist
Commit your free and nil-changes to my private branch. alexs, the FPC-Versioncheck should be done in ZeosLazarus.inc..

Posted: 25.02.2012, 11:51
by ism
where string

Code: Select all

if not (Assigned(FParams) and Assigned(FStatements)) then exit;
in commit ?

because
Ошибка:
в файле ZSQLStrings.pas в строке 361
FParams.Clear;
http://freepascal.ru/forum/viewtopic.ph ... 3#postform

Posted: 25.02.2012, 14:17
by EgonHugeist
Ism, i need a better documentation.. Where are the lines? For what is the pach? In which file? Can't read the cyrlic Characters of the fpc.ru forum..

Posted: 25.02.2012, 14:24
by ism
in first message patch alexs see string

Code: Select all

+  if not (Assigned(FParams) and Assigned(FStatements)) then exit;

Code: Select all

Index: src/component/ZSqlStrings.pas
===================================================================
--- src/component/ZSqlStrings.pas	(revision 887)
+++ src/component/ZSqlStrings.pas	(working copy)
@@ -197,8 +197,8 @@
 }
 destructor TZSQLStrings.Destroy;
 begin
-  FParams.Free;
-  FStatements.Free;
+  FreeAndNil(FParams);
+  FreeAndNil(FStatements);
   inherited Destroy;
 end;
 
@@ -357,6 +357,8 @@
   end;
 
 begin
+  if not (Assigned(FParams) and Assigned(FStatements)) then exit;
+
   FParams.Clear;
   FStatements.Clear;
   SQL := '';
in testing-egonhugeist rev 1034

Code: Select all

Index: ZSqlStrings.pas
===================================================================
--- ZSqlStrings.pas	(revision 1033)
+++ ZSqlStrings.pas	(revision 1034)
@@ -198,8 +198,8 @@
 }
 destructor TZSQLStrings.Destroy;
 begin
-  FParams.Free;
-  FStatements.Free;
+  FreeAndNil(FParams);//.Free;
+  FreeAndNil(FStatements);//.Free;
   inherited Destroy;
 end;

not found string

Code: Select all

@@ -357,6 +357,8 @@
   end;
 
 begin
+  if not (Assigned(FParams) and Assigned(FStatements)) then exit;
+
   FParams.Clear;
   FStatements.Clear;
   SQL := '';

Posted: 25.02.2012, 14:45
by EgonHugeist
Alexs ZSQLStrings.pas Patch done in testing and testing-egonhugeist rev. 1038 Your other thread is solved too...