Sign in Join

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

Mailing lists / lazarus / 1999-06

TStrings problem

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Baeseman, Cliff

Here is one problem that I ran across lately with the TStrings object.

Code to duplicate the error goes something like this.

var
string1: TStrings;
string2: TStrings;
inif: TIniFile;
procedure buggy;
begin
  string1 := TStringList.Create;
  string2 := TStringList.Create;
  inif := TIniFile.Create('/etc/test.ini');
  inif.ReadSection('PATHS',string1);
  inif.ReadSection('UNITS',string2);      <----the second reference to a

TStrings always segs?

end;

This same problem seems to occur any time I reference more than one TStrings at a time. It also happens when passing
a TStrings object to a property or passing to a procedure and or a reference to a global TStrings object.

this is while using the H and I switches and objfpc....

This I can hack around but it would be nice if fixed. I would really like to use the TIniFile unit.

Cliff

- "If you kiss me, I'll turn into a beautiful princess."
- "Look, I'm a computer programmer. I don't have time for girls, but a talking frog is very very cool."

Reply by email

Jeff Wormsley
to Baeseman, Cliff

*********** REPLY SEPARATOR ***********

Cliff wrote 21 lines
Here is one problem that I ran across lately with the TStrings object. Code to duplicate the error goes something like this. var string1: TStrings; string2: TStrings; inif: TIniFile; procedure buggy; begin string1 := TStringList.Create; string2 := TStringList.Create; inif := TIniFile.Create('/etc/test.ini'); inif.ReadSection('PATHS',string1); inif.ReadSection('UNITS',string2); <----the second reference to a TStrings always segs? end;

Is there any significance to the fact you are declaring TStrings and yet creating TStringLists? And if this is based on Delphi TStrings, aren't there abstracted methods in TStrings that need to be overidden? Assuming you just typoed TStrings instead of TStringlist, what exactly is going on with ReadSection? I take it that it is reading in a group of entries and populating the string list? What methods of a stringlist are ReadSection calling? That is where I would concentrate the search, see what ReadSection is doing to the string list, and hand execute the code to see why it segs.

Jeff.

Show quoted text 25 lines
This same problem seems to occur any time I reference more than one TStrings at a time. It also happens when passing a TStrings object to a property or passing to a procedure and or a reference to a global TStrings object. this is while using the H and I switches and objfpc.... This I can hack around but it would be nice if fixed. I would really like to use the TIniFile unit. Cliff - "If you kiss me, I'll turn into a beautiful princess." - "Look, I'm a computer programmer. I don't have time for girls, but a talking frog is very very cool." _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.miraclec.com/list_archives/lazarus

Reply by email