How to break ITask in Delphi/Firemonkey

  

I use the following block:

TTask.Run(procedure
begin
TThread.Synchronize(nil, procedure
begin
loader.Visible := true;
end);

… SQL SELECT

TThread.Synchronize(nil, procedure
begin
loader.Visible := false;
end);
end);

In general, everything is OK. The problem occurs when I close the Form
while executing the SELECT procedure.
When I reopen this Form, the loader is active, but the SQL function no longer performs.

How can I complete all Tasks before closing the forms?

Comments are closed.