Sign in Join

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

Mailing lists / lazarus / 2010-08

Strange Access Violation

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Dave Coventry

I'm using a name/value comma-separated string to read a DXF drawing file into a TStringList.

The comma-separated string is probably 200 characters long.

I'm getting an exception class 'External: SIGSEGV' and 'RunError(216)'.

Here is the offending code:

01    for i:=0 to ElementCount do
02    begin
03      CommaString:=LoadElementFromNumber(i);
04      if CommaString'' then
05      begin
06        ElementList:=TStringList.Create;
07        ElementList.CommaText:=CommaString;
08        CheckElementExtents(ElementList);
09        ElementList.Free;
10      end;
11    end;

The loop repeats without problem until i=10 but fails with Errors occur on ElementList.Free. (Line 09). ElementCount = 20.

I'm using SVN Revision 26845 on Ubuntu.

Can someone suggest what I'm doing wrong?

Reply by email

ajv
to Dave Coventry

First use a Try Except clause:

01    for i:=0 to ElementCount do
02    begin
03      CommaString:=LoadElementFromNumber(i);
04      if CommaString'' then
05      begin
06        ElementList:=TStringList.Create;
07        Try ElementList.CommaText:=CommaString;
08            Try CheckElementExtents(ElementList);
               Except
                  ShowMessage ('Something wrong with CheckElementExtents);
               End
09        Finally
              ElementList.Free;
           End
10      end;
11    end;

What are your results?
Anthony.
===========================================

Dave Coventry wrote 35 lines
I'm using a name/value comma-separated string to read a DXF drawing file into a TStringList. The comma-separated string is probably 200 characters long. I'm getting an exception class 'External: SIGSEGV' and 'RunError(216)'. Here is the offending code: 01 for i:=0 to ElementCount do 02 begin 03 CommaString:=LoadElementFromNumber(i); 04 if CommaString'' then 05 begin 06 ElementList:=TStringList.Create; 07 ElementList.CommaText:=CommaString; 08 CheckElementExtents(ElementList); 09 ElementList.Free; 10 end; 11 end; The loop repeats without problem until i=10 but fails with Errors occur on ElementList.Free. (Line 09). ElementCount = 20. I'm using SVN Revision 26845 on Ubuntu. Can someone suggest what I'm doing wrong? -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Dave Coventry
to ajv

Hi Anthony, thanks for the assistance.

In my distant memory I thought I could remember having a very similar issue before, so I googled using my name as one the search parameters and sure enough I turned this thread up:

http:/msg07161.html

Then I remembered that it had to do with passing the TStringList as an argument.

I solved it a couple of years ago by passing the argument as a string and then processing the string within the function.

Anyway, it works.

Sorry for causing hassles.

Dave

Reply by email