[Lazarus] Exception with threads

Bernd Kreuss prof7bit at googlemail.com
Mon Aug 2 15:28:38 CEST 2010


On 02.08.2010 14:50, faber wrote:
> Hi,
> I've problems with threads. (Win32).
> As example, that code is executed in thread:
>     try
>     spTr.LoadFromStream(ms_from_zip);
>     except
>        on EOutOfMemory do begin
>            Result:=12;
>            exit;
>        end;
>     end;
> but in that case thread mysteriously stops working.
> 
> When I use that code:
>     try
>     spTr.LoadFromStream(ms_from_zip);
>     except
>            Result:=12;
>            exit;
>     end;
> 
> then everything is ok.

Maybe it raises a different exception, in the first example you only
catch the EOutOfMemory.

from the manual: "If none of the On handlers matches the exception
object type, then the statement list after else is executed. If no such
list is found, then the exception is automatically re-raised. "

This means if it is not an EOutOfMemory then it will re-raise the exception.





More information about the Lazarus mailing list