Application crashes on exit when I close the main window, but not when I use quit menu... help?

So I’ve finally carved out time to convert my app from 32 to 64 bit for OS X, given the impending deadline for dropping 32 bit apps there. I’ve experimented in the past but run into a number of issues, so I’ve been putting it off for as long as possible.

The day of reckoning has finally arrived.

I’m impressed so far that the application appears to behave perfectly when compiled as a 64 bit app, and it appears that waiting did fix a number of issues I ran into in the past… however, there is one problem that I can’t seem to figure out:

If I quit my application with the Command-Q key shortcut, it quits cleanly. If I close my app’s main window, I get a core dump from the OS.

I’ve created a little screencast that illustrates this. I’d appreciate any ideas anyone has.

Thanks!

Do you have app.autoquit = True in your code?

Hi Roger,

No, I do not have app.autoquit = True anywhere in the source.

Also, this behavior happens on both OS X 10.12 and 10.13.

I chuckle everytime I see that phrase… doubt anyone under 30 even knows what it REALLY means :slight_smile:

Yeah, I’m getting to be a grandpa in the world of software engineering, I’m afraid…

Dang… what does that make ME then? :frowning: I started in this industry in 1975 (yeah, pre-Apple, pre-PC even)

If you put

autoquit = True

in the app.Open event I bet that solves your problem as your app will quit when you close the last window

Which version of Xojo are you using? There’s a problem with a window delegate, are you using and declares or plugins?

Post the crash log.

I seem to remember that quitting in 64bit was discussed before. My problem is that 64bit doesn’t quit at all. A declare was posted which solves this problem:

[code]#if Target64Bit 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]

This cleanly terminates the app.

I had a similar problem, I fixed it placing my document closing code into the ‘CancelClose’ event. That way it looks like the document close code is ran before the app close event. That was my problem and it looks like yours is very similar.

crash logs?

As they say in Holland: “Wisdom comes with the years”. So you are a wise man and Kimball has to go a lot of years before that. :wink:

There was also an issue (resolved in 2018.1) where closing a window with a listbox cell highlighted would cause a crash. Wonder if that’s related.

I mentioned it in the video: compiled with 2018R1, but I’ve also tested with 2017R3 with the same result.

Several folks have asked to see the full crash log. Here it is.

I’ve had this suggested elsewhere, and am about to try it…

triggered… I’ve been told that I’m wise beyond my years…

Looks like this problem here: https://forum.xojo.com/47243-runtimeviewdestructor-crashes-on-macos-10-13

Moving the quit code to CancelClose instead of Close did not solve the problem, when compiling from 2018R1.

I think Beatrix is probably right, it looks VERY similar to <https://xojo.com/issue/51965>.

@Christian Schmitz - in your feedback report referenced above (#51965) you commented:

Where, specifically should I put this loop?

Thanks!