Subject Re: Exiting gracefully from lost connection error (335544721)
Author Adam
--- In, "almfgingras"
<almfgingras@y...> wrote:
> Thank you for the suggestion Adam. Unfortunately, I get the same
> result with the close command as I do with Application.Terminate.
> I think that the error is generated when the database component is
> freed, which is done automatically when its owner is destroyed. At
> that specific time, I can no longer intercept the exception, which
> results in the 'Send error report to Microsoft' dialog.
> Philippe

I have never seen that behaviour with database connection components.
I have seen it when using a TObjectList derivative of visual
components when OwnsObjects is true but the owner of the component is
the form etc (until I woke up and realised there is a TComponentlist
for that task).

I wonder what the database component is trying to do when it is free.
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.