On Wed, 30 Sep 2015, Susie Nicol wrote:

Hi

I have an application with a main form, and several others whuich are only
ever used in modal form.

The application is slow to terminate, and I cannot see why.  The shutdown
procedure, simplified a little looks like this: (datamodified a global
Boolean; savedata another procedure in the same unit; the SQLcomponents are
in a a data module)

procedure FinishUp;

begin
 if datamodified then
   savedata;

sqltransaction1.commit;
sqlconnection.close(True);

Application.Terminate  {line A}

end;

The debugger shows me that everything is fine until line A, when the
program hangs: often for 15 seconds, sometimes for ever.

XFCE on Linux complains that the window containing the main form cannot be
closed because 'the application may be busy'.

I have tried to replace line A with 'halt' or 'close' without any
difference. The connection to the database is indeed closed.

1. Are you using threads ?
2. Do you create a lot of components dynamically that are freed in the 
destructor of the form ?

Both can cause significant delays.


I am using Lazarus 1.4.2, 64-bit, Linux XFCE desktop, GTK+2 widget set.

Any suggestions about where to look next will be very welcome.

What I usually do in such case is not use the debugger, but check using the strace command-line utility if there is still some activity in the application:

Put a writeln('something') before and after the Application.Terminate, and check what happens between the write() commands in strace's output.

Michael.

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to