As read in https://forum.xojo.com/45394-macos-64-bit-crash-after-application-exit/p1#p368799 I’m using Sam’s code to avoid the crash but I would appreciate some help on this:
My application enables autoquit and therefore closing main window quits. To save all data before quitting I added the cancel close event at application level and there I terminate, as I understood that a cancelclose event in the main window would cause the crash.
This is fine if user quits using menu but closing the main window I no longer have access to the data on it and can’t save.
Where should I place the cancel close event and terminate, at main window or at application level ? Please remember that first fires cancelclose at Application, then at windows and placing a terminate at App’s cancelclose prevents any window cancelclose to fire.
You don’t control WHERE a “CancelClose” event goes… That is predefined…
The purpose of this event is to allow the user (or process) to abort an already in progress closing sequence.
You should not include any code to further that sequence (ie. QUIT etc). Either return TRUE or FALSE and let CLOSE do its thing
As to which CancelClose (App or Window) it depends on your purpose… at the WIndow level it is usually used to abort closing the WIndow
Dave, yes I understand the purpose of CancelClose, may be I had to say “which cancelclose event I should use” instead of “place”.
But I can’t simply let close, I need to force with Terminate because many times the app crashes after closing (Mac High Sierra and Mojave) and Sam’s code at the CancelClose event prevents this crash but I want to make sure I use the correct cancelclose event (window or app).