Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-03

TStringList.Destroy generate SIGSEGV with Zeos 6.6.6

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Daniel Simoes de Ameida

Hi All,
On recent FPC 2.6.1 I notice a strange behavior with TStringList.Destroy TStringList.Destroy, calls method TStringList.Clear, but the problem is that TStringList.Clear call methods Changing and Changed

This affect Zeos 6.6.6, I presume is because Zeos try to read Params from the SQL.Text, every time a Change occurs

I suggest a new InternalClear method, without calling Change/Changed that can be used in Destroy and Clear methods...

Some thing like this:

destructor TStringList.Destroy;
Var I : Longint;
begin
? FOnChange:=Nil;
? FOnChanging:=Nil;
? InternalClear;
? Inherited destroy;
end;
Procedure TStringList.Clear;
Var I : longint;
begin
? if FCount = 0 then Exit;
? Changing;
? InternalClear;
? Changed;
end;
Procedure TStringList.InternalClear;? (Private)
Var I : longint;
begin
? if FCount = 0 then Exit;
?
? if FOwnsObjects then
??? begin
????? For I:=0 to FCount-1 do
??????? begin
????????? Flist^[I].FString:='';
????????? freeandnil(Flist^[i].FObject);
??????? end;
??? end
? else
??? begin
????? For I:=0 to FCount-1 do
??????? Flist^[I].FString:='';
??? end;
? FCount:=0;
? SetCapacity(0);
end;

?
[]s Daniel

Conhe?a o Projeto ACBr - Automa?ao Comercial Brasil DJSystem a Loja Patrocinadora do ACBr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120330/689f64eb/attachment.html>

Reply by email

Vincent Snijders
to Daniel Simoes de Ameida

Op 30 maart 2012 16:37 heeft Daniel Simoes de Ameida het volgende geschreven:

Show quoted text 11 lines
Hi All, On recent FPC 2.6.1 I notice a strange behavior with TStringList.Destroy TStringList.Destroy, calls method TStringList.Clear, but the problem is that TStringList.Clear call methods Changing and Changed This affect Zeos 6.6.6, I presume is because Zeos try to read Params from the SQL.Text, every time a Change occurs I suggest a new InternalClear method, without calling Change/Changed that can be used in Destroy and Clear methods...

see also:
http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=rev&revision=20570

Vincent

Reply by email

zeljko
to Daniel Simoes de Ameida: On recent FPC 2.6.1 I notice a strange behavior with TStringList.Destroy…
Daniel Simoes de Ameida wrote 10 lines
Hi All, On recent FPC 2.6.1 I notice a strange behavior with TStringList.Destroy TStringList.Destroy, calls method TStringList.Clear, but the problem is that TStringList.Clear call methods Changing and Changed This affect Zeos 6.6.6, I presume is because Zeos try to read Params from the SQL.Text, every time a Change occurs I suggest a new InternalClear method, without calling Change/Changed that can be used in Destroy and Clear methods...

No, just call Clear before destroying FSQL (afair) ...that's how I patched my zeos copy and it works fine.

--- trunk/zeosdbo/src/component/ZAbstractRODataset.pas	2012/01/09 14:53:38
1368
+++ trunk/zeosdbo/src/component/ZAbstractRODataset.pas	2012/03/07 10:38:11	1385
@@ -531,7 +531,7 @@
     except
     end;
   end;
-
+  FSQL.Clear;
   FreeAndNil(FSQL);
   FreeAndNil(FParams);
   FreeAndNil(FCurrentRows);

zeljko

Show quoted text 50 lines
Some thing like this: destructor TStringList.Destroy; Var I : Longint; begin FOnChange:=Nil; FOnChanging:=Nil; InternalClear; Inherited destroy; end; Procedure TStringList.Clear; Var I : longint; begin if FCount = 0 then Exit; Changing; InternalClear; Changed; end; Procedure TStringList.InternalClear; (Private) Var I : longint; begin if FCount = 0 then Exit; if FOwnsObjects then begin For I:=0 to FCount-1 do begin Flist^[I].FString:=''; freeandnil(Flist^[i].FObject); end; end else begin For I:=0 to FCount-1 do Flist^[I].FString:=''; end; FCount:=0; SetCapacity(0); end; []s Daniel Conhe?a o Projeto ACBr - Automa?ao Comercial Brasil DJSystem a Loja Patrocinadora do ACBr

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120331/3b8c8a7c/attachment.html>

Reply by email

Luiz Americo Pereira Camara
to Daniel Simoes de Ameida: On recent FPC 2.6.1 I notice a strange behavior with TStringList.Destroy…
Daniel Simoes de Ameida wrote 11 lines
Hi All, On recent FPC 2.6.1 I notice a strange behavior with TStringList.Destroy TStringList.Destroy, calls method TStringList.Clear, but the problem is that TStringList.Clear call methods Changing and Changed This affect Zeos 6.6.6, I presume is because Zeos try to read Params from the SQL.Text, every time a Change occurs I suggest a new InternalClear method, without calling Change/Changed that can be used in Destroy and Clear methods...

It was already done a week ago.

See http://bugs.freepascal.org/view.php?id=21529

Luiz

Show quoted text 56 lines
Some thing like this: destructor TStringList.Destroy; Var I : Longint; begin FOnChange:=Nil; FOnChanging:=Nil; InternalClear; Inherited destroy; end; Procedure TStringList.Clear; Var I : longint; begin if FCount = 0 then Exit; Changing; InternalClear; Changed; end; Procedure TStringList.InternalClear; (Private) Var I : longint; begin if FCount = 0 then Exit; if FOwnsObjects then begin For I:=0 to FCount-1 do begin Flist^[I].FString:=''; freeandnil(Flist^[i].FObject); end; end else begin For I:=0 to FCount-1 do Flist^[I].FString:=''; end; FCount:=0; SetCapacity(0); end; []s Daniel Conhe?a o Projeto ACBr - Automa?ao Comercial Brasil <http://acbr.sourceforge.net> DJSystem a Loja Patrocinadora do ACBr <http://www.djsystem.com.br> -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Daniel Simoes de Ameida
to zeljko: No, just call Clear before destroying FSQL (afair) ...that's how I patched my zeos copy…

Thanks Zeljko, It works

?
[]s Daniel

Conhe?a o Projeto ACBr - Automa?ao Comercial Brasil DJSystem a Loja Patrocinadora do ACBr

Show quoted text 103 lines
________________________________ De: zeljko Para: Enviadas: S?bado, 31 de Mar?o de 2012 3:47 Assunto: Re: [Lazarus] TStringList.Destroy generate SIGSEGV with Zeos 6.6.6 On Friday 30 of March 2012 16:37:09 Daniel Simoes de Ameida wrote: > Hi All, > On recent FPC 2.6.1 I notice a strange behavior with TStringList.Destroy > TStringList.Destroy, calls method TStringList.Clear, but the problem is > that TStringList.Clear call methods Changing and Changed > > This affect Zeos 6.6.6, I presume is because Zeos try to read Params from > the SQL.Text, every time a Change occurs > > I suggest a new InternalClear method, without calling Change/Changed that > can be used in Destroy and Clear methods... No, just call Clear before destroying FSQL (afair) ...that's how I patched my zeos copy and it works fine. --- trunk/zeosdbo/src/component/ZAbstractRODataset.pas 2012/01/09 14:53:38 1368 +++ trunk/zeosdbo/src/component/ZAbstractRODataset.pas 2012/03/07 10:38:11 1385 @@ -531,7 +531,7 @@ except end; end; - + FSQL.Clear; FreeAndNil(FSQL); FreeAndNil(FParams); FreeAndNil(FCurrentRows); zeljko > > Some thing like this: > > destructor TStringList.Destroy; > Var I : Longint; > begin > ? FOnChange:=Nil; > ? FOnChanging:=Nil; > ? InternalClear; > ? Inherited destroy; > end; > > Procedure TStringList.Clear; > Var I : longint; > begin > ? if FCount = 0 then Exit; > ? Changing; > ? InternalClear; > ? Changed; > end; > > Procedure TStringList.InternalClear;? (Private) > Var I : longint; > begin > ? if FCount = 0 then Exit; > ? > ? if FOwnsObjects then > ??? begin > ????? For I:=0 to FCount-1 do > ??????? begin > ????????? Flist^[I].FString:=''; > ????????? freeandnil(Flist^[i].FObject); > ??????? end; > ??? end > ? else > ??? begin > ????? For I:=0 to FCount-1 do > ??????? Flist^[I].FString:=''; > ??? end; > ? FCount:=0; > ? SetCapacity(0); > end; > > > > ? > []s Daniel > > Conhe?a o Projeto ACBr - Automa?ao Comercial Brasil > DJSystem a Loja Patrocinadora do ACBr -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120331/3e3bb38d/attachment-0001.html>

Reply by email