[Lazarus] about raised exception class 'External: SIGSEGV'

Luca Olivetti luca at wetron.es
Mon Apr 14 15:58:14 CEST 2014


El 14/04/14 12:49, FreeMan ha escrit:
> 
> Hello,
> I get this errors some time, I can not handle this error so I don't know
> why raised.
>  
> Project myproject raised exception class 'External: SIGSEGV'. -> Ok and
> continue to run application

It's an access to unallocated memory or trying to use a class instance
that doesn't exist (i.e. it is nil).
Since I don't know your program, maybe one of the FieldByName call is
returning nil (i.e., a field with that name doesn't exist, so either the
IsNull or the AsInteger would generate a SIGSEV:

> if not QUE_1.FieldByName('UNQ_ID').IsNull and
> (QUE_1.FieldByName('UNQ_ID').AsInteger>=0)then
> Unq_id := QUE_1.FieldByName('UNQ_ID').AsInteger
> else Unq_id := -1;
> QUE_1.Close;
> QUE_1.Open;
> if Unq_id<>-1then QUE_1.Locate('UNQ_ID', Unq_id, []);
> 
> if not QUE_2.FieldByName('UNQ_ID').IsNull and
> (QUE_2.FieldByName('UNQ_ID').AsInteger>=0)then
> Unq_id := QUE_2.FieldByName('UNQ_ID').AsInteger
> else Unq_id := -1;

> try-except not handle this error. 

No currently it doesn't :-(
Note that in most cases when hitting such an error the only sensible
option would be to terminate the program, but I'd like to intercept the
exception and log it to a file before terminating the program, so I can
do a post-mortem and see where the SIGSEV occurred.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es
Tel. +34 935883004  Fax +34 935883007




More information about the Lazarus mailing list