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

Michael Van Canneyt michael at freepascal.org
Mon Mar 27 16:13:29 CEST 2023



On Mon, 27 Mar 2023, Luca Olivetti via lazarus wrote:

> El 27/3/23 a les 11:59, Luca Olivetti via lazarus ha escrit:
>
>> [*] instead of opening the query I spawn a thread that opens it, wait for 
>> it to finish while executing Application.ProcessMessages and eventually 
>> reraise the exception that was generated inside the thread.
>
>
> Speaking of which, I encapsulated it in a procedure (TWaitForm is the spash 
> screen, Aproc is a procedure of object, TExecInThread simply calls AProc in 
> its execute method):
>
> procedure ExecWithSplash(AProc:TThreadProc);
> var wf:TWaitForm;
>    ut:TExecInThread;
> begin
>  Wf:=TWaitForm.Create(Application);
>  WF.Show;
>  ut:=TExecInThread.create(AProc);
>  while not ut.Finished
>    Application.ProcessMessages
>  wf.free;
>  if ut.FatalException<>nil then
>    raise(ut.FatalException);
>  ut.free;

Ehm. In case of an exception, ut will never be freed ?

Michael.


More information about the lazarus mailing list