Subject Re: Exiting gracefully from lost connection error (335544721)
Author almfgingras
--- In, "Adam" <s3057043@y...>
> I have never seen that behaviour with database connection
> I have seen it when using a TObjectList derivative of visual
> components when OwnsObjects is true but the owner of the component
> the form etc (until I woke up and realised there is a
> for that task).
> I wonder what the database component is trying to do when it is
> The only thing I can think of is if it is sending a rollback or
> something to any attached transaction. Does it help maybe to assign
> the transaction to null before closing, or maybe to explicitly free
> both objects in a specified order in the ondestroy event? Then you
> should not have the objects attempting to access an object that has
> previously been freed.
> Adam

You may be right Adam, the problem may very well come from the
transaction component instead of the database component itself.
However, I am not sure if it is a good idea to nullify any component
that has not yet been freed for fear to create an access violation
when its owner tries to free it at a later time.

I tried to explicitely free the database and transaction components
in various orders without success (i.e. I get some access violations
each time).

For the time being, I think I will stick with Terry's suggestion to
use ExitProcess(0) instead of Application.Terminate, which seems to
very well address the problem to a certain degree.

Many thanks again for taking the time to suggest some possible
solutions to this problem.