Crash upon Exit

macOS 10.12.3
Xojo 2017R1

I am having some problems when my app closes, it displays an error with the ability to report to Apple. I have copied the crash log and it is available here:
Crash Log

I have code in the App.UnhandledException routine but that does not get called, so the crash occurs after the program thinks it has exited (I think).

Can someone have a look at the crash log as I don’t really know what I am looking at? The app is compiled in 64 bit mode.

Thanks all.

If you can reproduce this reliably and upload the project (or app) somewhere, I’d love to take a look. A Feedback bug report would work best.


You can download a copy here:

SQLite Control

I’ve tried, but I can’t get it to crash on exit. Do you have specific steps?


You need to open a SQLite database. Create a simple select query in the SQL tab and run it. Then just press the Main window close icon (top left).

That is when I get the crash.

just try this and did not get any crash

No, it’s odd. The crash occurs occasionally. The setup that I used whilst testing and getting the crash was as I described to Joe above but it is not consistent as I can see now.

This crashing has been with me nearly forever when compiling to 64 bit. I do not get it in a 32 bit app.

I was able to reproduce this, though I haven’t looked into it or attempted to make a more stripped-down example.

Thanks Joe.

I will wait to see what you can find. As the app works fine until termination and nothing is lost even in the termination I can live with it for now.

Do you have things in Close events that should be in CancelClose?

No. Following another thread I saw that this might be the problem so I moved all the code from the Close event to the CancelClose event.

I do still have the Quit command in the Close event. Should that be in CancelClose too?

Putting Quit in Close is the right place.

Do you have any thread that could have been left running ?

Michel, no.

This is what I don’t understand. I rarely use threads and I am certainly not using threads at all in this particular app. Following your comments in another post I reviewed my Close event code and realised that there was stuff in there that was probably causing the issue on the 64 bit app. I put the Close stuff in the CancelClose event (apart from Quit) and all seemed to run fine. As soon as I deployed the app I saw the issue, but only occasionally.

As I am not really a technical guy I don’t understand the crash log that Apple supplies in the event but I did keep a copy that I referred to above.

I put code in the App.UnhandledException event to at least trap the error but this code is never called. To my mind, therefore, the error has occurred after the app thinks it has closed. I am at a loss.

You may try to set Autoquit = True in App.Open, and instead of using Quit, simply make sure all windows are closed.

Something like

For i As Integer = WindowCount - 1 DownTo 0 Dim w As Window = Window(i) If w <> Nil Then w.close End If Next

This should be much safer, since the app won’t close until all housekeeping had occurred in each window.

That’s a good idea, Michel. I will have a go in setting AutoQuit.

Your other suggestion is good, too. However, I only have the one window in this app. The whole thing is controlled with container controls that are not created dynamically but placed directly on the page panel in the main window. So, everything within the app is owned by the main window and it is in the main window that I have the CancelClose and Close events.

I will try the AutoQuit now.

As far as I can tell setting AutoQuit rather than using Quit has solved my problem, so I have marked Michel’s suggestion as answering my problem.

I have deployed the Version 1.9.9 of SQLite Control in 64 bit here:
SQLite Control

Thanks to all who have helped and offered suggestions.

I have the same problem and it’s worse on Mac OS 10.13 with my 64bit compiled applications.
‘Quit’ in the Window.close event has worked for years and suddenly it causes app crashes.

Removing ‘Quit’ from window.close and adding autoquit=true at app-level solved it for me too!

OK, I may found a solution (not a nice one).

When I put this in the App close event:


The app didn’t crash anymore.

I have the same problem- simple apps (with or without databases) result in a “this program ended unexpectedly” error message when closed in MAC OSX 10.10.5 IF compiled in 64 bit. No problem when compiled 32 bit. I think this should be considered a “bug to be fixed” as it is awkward to remove and replace all quit statements (often use them in ‘sudden death’ routines that app opening uses to check for expected sql databases, if folder and or file is not found then I make app notify user and then quit).

Should not have to remove and replace quit statements to fix problem 64 bit compilation causes with quit. Note XOJO documentation recommends Quit so app does not persist when user thinks they have closed it. If the bug does not get fixed, the quit documentation should be amended… humble opinion of a not too sophisticated user writing relatively simple household apps.