[Lazarus] animated splash screen for lengthy operation, works with windows, doesn't with linux

Luca Olivetti luca at wetron.es
Mon Mar 27 16:11:52 CEST 2023


El 27/3/23 a les 15:55, Jean SUZINEAU via lazarus ha escrit:
> Le 27/03/2023 à 14:40, Luca Olivetti via lazarus a écrit :
>> The problem here is, if AProc raises an exception, I cannot free the 
>> thread causing a leak. 
> 
> May be you can create a new exception class specifically for 
> ExecWithSplash,
> instantiate it and put all the information of ut.FatalException in the 
> new exception instance before raising it?

Creating a specific exception class wouldn't solve the problem on how to 
make a deep copy of the original exception.
I can just store the message an raise it again, losing the rest of the 
details, i.e.:

   ExceptionMessage:='';
   if ut.FatalException<>nil then
     ExceptionMessage:=Exception(ut.FatalException).Message;
   ut.free;
   if ExceptionMessage<>'' then
     raise Exception.create(ExceptionMessage);



The goal is to easily substitute the original code:


   try
     dosomething;
     dosomethingelse;
     ....
   except
     ....
   end;


with

   try
     ExecWithSplash(@doit);
   except
     ...
   end;


procedure TMyDatamodule.doit;
begin
   dosomething;
   dosomethingelse;
end;

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007



More information about the lazarus mailing list