TCastleView.Stop called from FINALIZATION section

I will just add that I still don’t recommend OnCloseQuery for this purpose, for reasons explained in comment in Where to intercept closing application? - #3 by michalis :slight_smile: I know it works in your project, but in general

  • OnCloseQuery is a way to “ask for confirmation before closing form (e.g. to save some document)”, not “a place to do cleanup”.

  • Stop is a place to do cleanup, and if you want Stop of your view to happen before some finalization, then use Application.MainWindow.Container.View := nil , as shown in this thread (point 3 above, which I understand the OP followed) or Where to intercept closing application? - #3 by michalis .