[code]#If TargetMacOS Then
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)
Dim appInstance As Integer = sharedApplication(NSClassFromString(“NSApplication”))
terminate(appInstance, appInstance) #EndIf[/code]
Who knows? I got the problem once in a tiny project - like 6 locs. No declares at all. Since I didn’t get the crash again I would assume timing issue and Xojo bug. I didn’t find any Feedback issue for the problem, though.
I have also been seeing this randomly will all my Xojo apps since installing macOS 10.14.
To me this seems like a macOS bug since I never had this problem before 10.14.
Sometimes it takes closing a particular window 3 or 4 times but eventually it crashes with:
Application Specific Information:
abort() called
Application Name(1238,0x1126565c0) malloc: Incorrect checksum for freed object 0x7fdf13e5e370: probably modified after being freed.
Corrupt value: 0x7
I have one window and the app that closed recently that crashed.
I don’t have the window’s code yet for the crash, but it also referred to another window as it closes.
They are both from this same app on Mac High Sierra.
I happened to be debugging it just because of this, and it’s basically short.
The app’s code was also at the very end.
If YPUbnd > -1 Then //this is a computed property
ClsingNot = False//a property
me.RecentItems.SveRecents()//a method
YPrf.SavPractWrdFiles(False)//a method
End If
Return//Return or end of App
The app crashed at the very end.
Thoughts?
Looks like I can’t blame macOS 10.14. I’m seeing this crash on High Sierra as well.
I thought it may be related to timers on the window but I also have a window with no timers that randomly crashes when closed… weird. I will keep experimenting.
Feedback bug filed 53670.
Sorry, I cannot figure out to paste this as a link.
If you have any info like a crashreport, it would be good to file this as I have to report this as inconsistent and therefore probably not reproducible.
[quote=408775:@Tim Jones]Add this to App.Close after your code:
[code]#If TargetMacOS Then
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)
Dim appInstance As Integer = sharedApplication(NSClassFromString(“NSApplication”))
terminate(appInstance, appInstance) #EndIf[/code][/quote]
Sorry Tim, but this does not fix the problem.
I added your code to my app, and still see the bug.
and it’s not on window.close, it’s more on app.quit that I see this bug.
I too and on two different project, I put in the windows of the buttons “close” with as code “nomdefenetre. close” and there it no longer crashes…
french :
moi aussi et sur deux projet different, j’ai mis dans les fentres des boutons “Fermer” avec comme code “nomdefenetre.close” et l a ne plante plus du tout…
I’ve added it to the App.close, at the end of the method, after all other code.
I see the bug when I quit the app, without closing all the windows, it often happens
it did not happen before 2018r2