Mystery High Sierra Crash #1

My app (Lightwright) has been crashing for a few customers who are running it on High Sierra. There’s no real pattern and none of them are reproducible, but they are encountering crashes daily - usually in a different place each time. The app has been cleansed of all declares anywhere near the code that is crashing (there are only maybe 3 declares in use anywhere at all now), and all of the graphics have been converted to be multiples of 4 pixels. The app is built using Xojo 2016R3.

If anyone has suggestions for what might be causing these crashes, I’d love to hear them, I don’t see anything obvious, and Xojo isn’t raising an exception in either case. Here is a portion of the crash log for the first of today’s crashes. It happened when the user clicked a canvas-based button to choose a file to be opened.

Thank you!

[code]Process: Lightwright 6 [49091]
Path: /Applications/Lightwright 6
Identifier: com.mckernon.lightwright6
Version: 6.0.19 beta build 195 (
Code Type: X86 (Native)
Parent Process: ??? [1]
Responsible: Lightwright 6 [49091]

Date/Time: 2018-07-04 14:22:42.828 -0700
OS Version: Mac OS X 10.13.5 (17F77)

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue:

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
Performing @selector(performClick:) from sender XOJButton 0x6b47060
abort() called

Thread 0 Crashed:: Dispatch queue:
0 libsystem_kernel.dylib 0xa73c0eda __pthread_kill + 10
1 libsystem_pthread.dylib 0xa7579427 pthread_kill + 363
2 libsystem_c.dylib 0xa730f956 abort + 133
3 GLEngine 0x9b3e3846 gleCreateTextureObject + 277
4 GLEngine 0x9b3f4785 gleBindTexture + 154
5 GLEngine 0x9b3f46a8 glBindTexture_Exec + 363
6 0x94360066 CI::GLTextureManager::attach_IOSurface(__IOSurface*, bool, int, CI::TextureDescriptor const&, int, int, int, bool) + 166
7 0x94365709 CI::GLContext::bind_surface(__IOSurface*, CI::TextureDescriptor const&, bool, CI::SampleMode, CI::EdgeMode, int, int) + 219
8 0x9420752c CI::Context::bind_sampler(CI::TextureSampler const*, CGRect const&, int, CI::KernelArgumentType) + 500
9 0x94364746 CI::GLContext::bind_arguments(CI::ProgramNode const*, CGRect const&) + 524
10 0x94363cdc CI::GLContext::render_root_node(CI::TileTask*, CI::ProgramNode*, CGRect const&, void () block_pointer) + 1254
11 0x94206a21 CI::Context::recursive_render(CI::TileTask*, CI::Node*, CGRect const&, CI::Node*, bool) + 1949
12 0x94207130 CI::Context::render(CI::ProgramNode*, CGRect const&) + 90
13 0x94218f8a invocation function for block in CI::image_get_bitmap(CI::Context*, CI::Image*, CGRect, CGColorSpace*, CI::Bitmap*, bool) + 1316
14 0x9421c338 CI::recursive_tile(CI::RenderTask*, CI::Context*, char const*, CI::Node*, CGRect const&, CI::PixelFormat, CI::swizzle_info const&, CI::TileTask* (CI::ProgramNode*, CGRect) block_pointer) + 428
15 0x94216e1f CI::tile_node_graph(CI::Context*, char const*, CI::Node*, CGRect const&, CI::PixelFormat, CI::swizzle_info const&, CI::TileTask* (CI::ProgramNode*, CGRect) block_pointer) + 439
16 0x9421876a CI::image_get_bitmap(CI::Context*, CI::Image*, CGRect, CGColorSpace*, CI::Bitmap*, bool) + 1775
17 0x94219ebf CI::create_cgimage(CI::Context*, CI::Image*, CGRect, CGColorSpace*, CI::PixelFormat, bool, unsigned long) + 3668
18 0x941fb1e9 -[CIContext(Internal) _createCGImage:fromRect:format:colorSpace:deferred:textureLimit:] + 1107
19 0x941fa0eb -[CIContext createCGImage:fromRect:format:colorSpace:deferred:] + 95
20 0xa0095e1d CUIRenderer::CreateImageByApplyingEffectsToImage(CUIDescriptor const*, long, __CFArray const*, CGImage*, float, unsigned char, unsigned char, CGBlendMode&) const + 12409
21 0xa0097f88 CUIRenderer::CreateImage(CGRect, long, CUIDescriptor const*, unsigned char, CGImage**, long long*, unsigned char*, CGBlendMode*) const + 7938
22 0xa0055c0e CUIRenderer::DrawImage(CGRect, long, CUIDescriptor const*) const + 132
23 0xa0054cec CUICoreThemeRenderer::Draw(CUIDescriptor const*, CGAffineTransform, CUIReturnInfo&) + 1450
24 0xa0054585 CUIRenderer::Draw(CGRect, CGContext*, __CFDictionary const*, __CFDictionary const**) + 1819
25 0xa0053e2f CUIDraw + 254
26 0x914a88b2 __44-[NSAppearance _drawInRect:context:options:]_block_invoke + 65
27 0x91e80ada -[NSAppearance _callCoreUIWithBlock:options:] + 1132
28 0x91e82089 -[NSCompositeAppearance _callCoreUIWithBlock:options:] + 158
29 0x914a886b -[NSAppearance _drawInRect:context:options:] + 102
30 0x914bf5cc -[NSCoreUIImageRep draw] + 435
31 0x914be1c9 -[NSImageRep drawInRect:] + 489
32 0x914bdfd1 __74-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]block_invoke_2 + 59
33 0x914bde1a NSGraphicsContextPushContextWithFlippedMetadata_drawWithBlock
+ 89
34 0x914bdca9 __74-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]block_invoke + 1318
35 0x914bd77b NSUsingGraphicsStateForHints_drawWithBlock
+ 209
36 0x914bd59b -[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:] + 809
37 0x914bc208 -[NSImage _drawMappingAlignmentRectToRect:withState:backgroundStyle:operation:fraction:flip:hints:] + 2126
38 0x9165eb80 -[NSSidebarImage _drawMappingAlignmentRectToRect:withState:backgroundStyle:operation:fraction:flip:hints:] + 207
39 0x914d044b -[NSImageCell _drawImageWithFrame:inView:] + 211
40 0x914d032a -[NSImageCell drawInteriorWithFrame:inView:] + 719
41 0x914b7466 -[NSImageView _processedImageForView:] + 563
42 0x914cffb1 __31-[NSImageView _updateImageView]_block_invoke + 118
43 0x914b66f1 -[NSView updateLayer] + 30
44 0x91bf564e _NSViewUpdateLayer + 56
45 0x914ac8f5 -[_NSViewBackingLayer display] + 517
46 0x9c15caf4 CA::Layer::display_if_needed(CA::Transaction*) + 700
47 0x9c15c5cd CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 27
48 0x9c15b5a2 CA::Context::commit_transaction(CA::Transaction*) + 310
49 0x9c15b1cb CA::Transaction::commit() + 459
50 0x91c51b66 __65+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayRefresh]_block_invoke + 465
51 0x937997a6 _runLoopObserverWithBlockContext + 22
53 0x937993d2 __CFRunLoopDoObservers + 498
54 0x9377c81d __CFRunLoopRun + 1661
55 0x9377be71 CFRunLoopRunSpecific + 641
56 0x9377bbda CFRunLoopRunInMode + 122
57 0x92d7937b RunCurrentEventLoopInMode + 321
58 0x92d78f5f ReceiveNextEventCommon + 454
59 0x92d78d7b _BlockUntilNextEventMatchingListInModeWithFilter + 71
60 0x9137ab2d _DPSNextEvent + 2101
61 0x91aece8c -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2859
62 0x91aec359 -[NSApplication(NSEvent) nextEventMatchingMask:untilDate:inMode:dequeue:] + 134
63 com.xojo.XojoFramework 0x065571e6 0x6515000 + 270822
64 0x91593ccd -[NSApplication _doModalLoop:peek:] + 540
65 0x91768c56 __35-[NSApplication runModalForWindow:]_block_invoke_2 + 165
66 0x91768ba2 __35-[NSApplication runModalForWindow:]_block_invoke + 79
67 0x91c14051 _NSTryRunModal + 119
68 0x915915aa -[NSApplication runModalForWindow:] + 109
69 0x91a5c749 -[NSSavePanel runModal] + 662
70 com.xojo.XojoFramework 0x0661d040 0x6515000 + 1081408
71 com.xojo.XojoFramework 0x0661ccad 0x6515000 + 1080493
72 com.xojo.XojoFramework 0x0661c541 FolderItemDialogShowModal + 79
73 com.mckernon.lightwright6 0x0007a188 FolderItemDialog.ShowModal%o%o + 59
74 com.mckernon.lightwright6 0x0272dc86 VWLinkWnd.VWLinkWnd.ChooseFileBtn_Action%%o<VWLinkWnd.VWLinkWnd>o + 4068[/code]

Looking at the log; I would assume that it’s coming from Core Animation, do you have any declares or plugins that use functions starting with CA?

My second suggestion is to try a newer version of Xojo; You’re using a two year old IDE on a one year old OS. Heck using a one year old IDE (even an older version of Xcode) doesn’t play nice on the latest version of the macOS.

Nope, no core animations. I have this one, which is used on a few critical windows:

Declare Function collectionBehavior Lib "AppKit" Selector "collectionBehavior" ( obj As Integer ) As UInteger
Declare Sub setCollectionBehavior Lib "AppKit" Selector "setCollectionBehavior:" ( obj As Integer, value As UInteger )
Const NSWindowCollectionBehaviorFullScreenAuxiliary As UInteger = 256

Dim behavior As UInteger = collectionBehavior(Self.Handle)

setCollectionBehavior(Self.handle, behavior Or NSWindowCollectionBehaviorFullScreenAuxiliary)

Maybe it’s not needed on High Sierra? It was needed beginning in El Capitan to keep certain windows from going full-screen.

I can’t use anything newer than 2016R3 because StringShapes and some other printing-related things broke beginning in 2017. Hopefully they’re on the list for fixing soon, I’m eager to get 64-bit up and running.

That crash looks like it’s coming from within GLEngine, does it not?

It’s still required if you DO NOT want your window to go full screen.

I can’t confirm for sure, it sure looks like the Save panel is doing some Core Animation, which then triggers an update on the sidebar, which it turns looks like it’s doing some Core Image manipulation and then on trying to draw this to the screen via an OpenGL context. If this is true, it shows that Apple isn’t using Metal 2 themselves for Core Image (at the moment the developer has to hard code to use OpenGL or Metal as a Core Image rendered. Metal 2 is so much faster than OpenGL (probably because Apple are still using an OpenGL version from 2010).

That’s my 2¢ on the report anyway. If there’s nothing directly manipulating Core Animation, Core Image or OpenGL, then this is most likely either an incompatibility between Xojo 2016 and High Sierra, or in my opinion it’s a borked install of High Sierra.

High Sierra has been a nightmare for advanced Core Image applications and I can’t wait for that POS OS version to disappear.

I had this too with one of my projects. It crashed literally at random.
It was fixed by compiling it with a newer Xojo version.

What about running in the IDE ?

I ask because I still use 2015r1, but when I fall into troubles, I load my project into the lastest version and run in the IDE (Xojo 2018r1.1 as of today).

[quote=394789:@Christoph De Vocht]I had this too with one of my projects. It crashed literally at random.
It was fixed by compiling it with a newer Xojo version.[/quote]

Which version worked for you?

In that case it was 2017R2

Unfortunately 2017 is the year that printing troubles started, which is why I’m stuck in 2016R3. Bummer…:frowning:

You mentioned troubles with printing. Could you elaborate? Nowadays I don’t think that using an older version of Xojo is a good idea.

I’d been using DrawRotatedTextMBS to print vertical text, but it stopped working because it needs HDC and Xojo’s printing is now based on DirectDraw. Rotated StringShapes print all over the place, not where you expect them - each different rotation amount changes the rotation center, with no obvious pattern.

And if you use a Printer Setup Dialog on Windows, the graphics instance you get to print in isn’t the whole page, it’s the area contained within the margins set in the dialog, there’s no way to print wherever you need to on the page - for instance, when printing a page of labels. On the Mac, you always get the entire printable area on the page.

So I’m stuck in 2016r3 until something changes - hopefully sooner rather than later. And no, using a version of Xojo that old isn’t good. I’m using 2018 only for non-printing projects.