[Lazarus] Console application does not close cleanly!

Bo Berglund bo.berglund at gmail.com
Sun Apr 10 21:20:06 CEST 2011


I was using Lazarus to create a console application for parsing out
data from a network speed test program.

In this case I used the Lazarus new project dialogue and specified a
console application with all the defaults.

This creates an application framework including command line parameter
parsing, which is good. I use the cl to pass file names (input and
output).

My problem is this:
I went to the section in DoRun where it states:
  { add your program here }

This is exatly what I did. The code parses out a report file and
extracts the valid data, then writes it out to a file (append at end
of that file) using TStringList.SaveToFile.
This all works fine so far, but when this is done the code gets to the
predefined statement:

  // stop program loop
  Terminate;

And here I am getting an exception:
External: SIGSEGV

If I comment out Terminate then the program never ends....

Is this specific to Ubuntu Linux or is it some error in my coding that
causes this?

I am using two objects in the DoRun, one TStringList and one object i
created for parsing the data. Both are created and then freed in a
try-finally construct before the Terminate call.

All is fine up until this spot, the file is parsed and the result is
written, yet I get the exception.

Can someone please explain this?


-- 
Bo Berglund
Developer in Sweden





More information about the Lazarus mailing list