On 30/3/2012 11:37, 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...


It was already done a week ago.

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

Luiz


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
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to