I’m still working on the crashes in 2026r2. One remaining crash happens when closing windows. I had some rather old window menu which I took out. The new code for closing is much more simple:
Function WindowCloseWindow() As Boolean
// Closes the frontmost document window from the Window menu.
Dim FrontWindow As Window = App.FirstDocumentWindow
If FrontWindow <> Nil Then FrontWindow.Close
Return True
exception exc
theException = new ErrorException(exc, currentMethodName)
End Function
But I already got a crash for my most complex window:
Keep in mind what Xojo tells: the values shown in the debugger may be unreliable in such crashes (access violation, etc). When I get one, I usually turn off “Break on fatal error” in the “Project” menu to get the usual behaviour (the OS crash dialog), which, IMO, is more helpful, as it contains more information. Have you tried seeing there?
Bare in mind that catching global exceptions like this you should check for “normal” exceptions for closing applications and threads.
Exception err As RuntimeException ' Will catch any exception without discrimination
If err IsA EndException Or err IsA ThreadEndException Then
Raise err // Re-raise the exception
End If
// Continue your code here
Not sure if this would be a solution for you but in the past I had some issues with any compiled Xojo app crashed when quiting the app.
Putting this in the Window CancelClose event helpt: (macOS only)
declare function NSClassFromString lib “Cocoa” ( aClassName as CFStringRef ) as integer declare function sharedApplication lib “Cocoa” selector “sharedApplication” ( classRef as integer ) as integer declare sub terminate lib “Cocoa” selector “terminate:” ( appRef as integer, sender as integer )
var appInstance as integer = sharedApplication( NSClassFromString( “NSApplication” ) ) terminate( appInstance, appInstance )
I have been using the declare for the last years because the app either wouldn’t quit or would crash. But this here is just closing a window. I had another crash where quitting with the main window and the window from this crash open would also crash but I think this one is solved.