Another crash on window close

I believe that this problem is different from the other outstanding thread going on right now about crashes on window close. In my case the crash reports are always the same:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib               	0x00007fff7631c31c objc_release + 28
1   libobjc.A.dylib               	0x00007fff7631d11a (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 710
2   com.apple.AppKit              	0x00007fff491a0c80 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2738
3   com.xojo.XojoFramework        	0x00000001053a72f5 0x1052d2000 + 873205
4   com.xojo.XojoFramework        	0x00000001053a7339 0x1052d2000 + 873273
5   com.shed.xtension             	0x0000000102daf095 Application._CallFunctionWithExceptionHandling%%o<Application>p + 181
6   com.xojo.XojoFramework        	0x000000010552c4bb CallFunctionWithExceptionHandling(void (*)()) + 262
7   com.xojo.XojoFramework        	0x00000001053a72a2 0x1052d2000 + 873122
8   com.apple.AppKit              	0x00007fff4919a83c -[NSApplication run] + 699
9   com.xojo.XojoFramework        	0x000000010552a82d RuntimeRun + 42
10  com.shed.xtension             	0x0000000102e6dd23 REALbasic._RuntimeRun + 19
11  com.shed.xtension             	0x000000010488f498 _Main + 536
12  com.shed.xtension             	0x000000010487d223 main + 19
13  libdyld.dylib                 	0x00007fff77aed3d5 start + 1

There isn’t even any of my code running there. This doesn’t happen all the time, but it happens often enough that I’m sure it’s a real problem. I suspect, but am not certain, that this started happening when the memory leak on window close was fixed a couple of release versions ago. I can go days of testing the software without any problem and then suddenly I save a document or close a window and boom the whole thing just crashes. This happens occasionally to my users as well. This is Mac software compiled with the latest 2019 r.1.1 version, but it also happened with 2019 and possibly before that I’m not sure.

Has anyone else seen anything similar?

I don’t know how you know you’ve not the same problem as us with PopupMenu?

I had looked at the crash reports in that thread and thought that they were very different from the above, but I’ve looked at more of them and there are some that are the same, so maybe it is the same problem after all. I will pay attention to see if there are popup menus on the windows that cause it. I feel like I’ve had it with windows that are basically just 1 big canvas but I’m not certain. I will watch.

I take it back, I think this is the same crash you all are seeing. It’s extremely frustrating for my users at the moment and I’m not sure how many Xojo versions I’d have to go back to fix it. I’ll add my weight to the other thread. I’ve managed to make this happen in my test system 4 or 5 times already this morning. All the windows involved had popup menus.

That looks like the kind of crashes I keep having in iClip - I get daily similar crash reports from my customers. It started when building iClip with RB 2019r1.1 - before I used a 2017 version, I think.

The crash stacks all vary a bit, but have in common that they happen when releasing objects in the Autorelease Pool, after closing a window.

Most often it either says:

or:

Can anyone confirm who had these crashes that they stopped occuring in a later Xojo version?

The related issues James mentioned appears to be this one: https://forum.xojo.com/50110-crash-on-a-window-close – However, that one involved PopupMenus (which I don’t use in the just-closed windows) and has a type of stack trace that I’ve not seen in mine. So, these may be different issues.

I battle with such crash in our documentation tool. Where a dialog comes up when you launch the application it allows you to select recent projects or make new one, then you click and the main window comes up.

When this dialog closes then it will randomly crash sometimes. I never have been able to pinpoint this or make a example where it crashes reliably. But from the sound of it then it sounds a bit like what your dealing with.

I have even tried to delay closing of the dialog putting the close on timer after it should close but with no better luck.

Björn, which Xojo version is it built with, and do the crash logs indicate that the crash happens when releasing objects or memory? That’s what my crashes show.

Maybe these help point to the problem?

https://forums.developer.apple.com/thread/60622
https://mjtsai.com/blog/2016/10/07/os_unfair_lock/

[quote][i]From what I’ve seen in some crash reports, os_unfair_lock is not happy with forked processes.

e.g.

BUG IN CLIENT OF LIBPLATFORM: os_unfair_lock is corrupt.

Moving to posix_spawn seems to make it happier.[/i]
[/quote]

Happens for me on all later year Xojo versions, I guess from 2017 to 2019r1 at least.

I dont actually get the close event in the log.

The modal dialog does show though and work. But when I press its close button then it sometimes blows up with this log.
(its not terrible for me per see since this is internal tool, I just launch it again until it works, but of course its still important to realize the problem so Xojo can be fixed some day)

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.xojo.XojoFramework 0x0000000102835bf3 RuntimeShowModal + 124
1 com.Einhugur.iDoc 0x0000000101fb7f64 Window.ShowModal%%o + 36
2 com.Einhugur.iDoc 0x00000001021915ab App.TimerAction%%oo + 299
3 com.xojo.XojoFramework 0x000000010283e6a1 0x1025dc000 + 2500257
4 com.apple.CoreFoundation 0x00007fff3911c625 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 20
5 com.apple.CoreFoundation 0x00007fff3911c1d1 __CFRunLoopDoTimer + 864
6 com.apple.CoreFoundation 0x00007fff3911bd0a __CFRunLoopDoTimers + 330
7 com.apple.CoreFoundation 0x00007fff390fd354 __CFRunLoopRun + 2141
8 com.apple.CoreFoundation 0x00007fff390fc8a5 CFRunLoopRunSpecific + 459
9 com.apple.HIToolbox 0x00007fff3834d1ab RunCurrentEventLoopInMode + 292
10 com.apple.HIToolbox 0x00007fff3834cded ReceiveNextEventCommon + 355
11 com.apple.HIToolbox 0x00007fff3834cc76 _BlockUntilNextEventMatchingListInModeWithFilter + 64
12 com.apple.AppKit 0x00007fff366e477d _DPSNextEvent + 1135
13 com.apple.AppKit 0x00007fff366e346b -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1361
14 com.xojo.XojoFramework 0x00000001026b12f5 0x1025dc000 + 873205
15 com.xojo.XojoFramework 0x00000001026b1339 0x1025dc000 + 873273
16 com.Einhugur.iDoc 0x0000000101fffd55 Application._CallFunctionWithExceptionHandling%%op + 181
17 com.xojo.XojoFramework 0x00000001028364bb CallFunctionWithExceptionHandling(void (*)()) + 262
18 com.xojo.XojoFramework 0x00000001026b12a2 0x1025dc000 + 873122
19 com.apple.AppKit 0x00007fff366dd588 -[NSApplication run] + 699
20 com.xojo.XojoFramework 0x000000010283482d RuntimeRun + 42
21 com.Einhugur.iDoc 0x000000010209c9f3 REALbasic._RuntimeRun + 19
22 com.Einhugur.iDoc 0x00000001023b0058 _Main + 536
23 com.Einhugur.iDoc 0x00000001023adc03 main + 19
24 libdyld.dylib 0x00007fff6511d3d5 start + 1

Björn, thanks for including the stack trace. What’s the crash message? Like one of mine?

Also, would you be able to rebuild your tool with a later Xojo version and see if that still crashes?

[quote=486594:@Thomas Tempelmann]Björn, thanks for including the stack trace. What’s the crash message? Like one of mine?

Also, would you be able to rebuild your tool with a later Xojo version and see if that still crashes?[/quote]

I do not get any crash message, it just goes down.

I would have to check if I can get it further on newer models, I only recently managed to build it with 2019r1, I guess there are maybe not huge changes since then to port it all the way up.