SimpleCocoaVTK example crashes on macOS 10.15.4, but not earlier macOS versions
On macOS 10.15.4, but not earlier, simply build and run the current git master version of the SimpleCocoaVTK example and resize the window. It will crash with backtrace:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: LIBSYSTEM, [0x2]
Application Specific Information:
assertion failure: "_needsGeometryInWindowDidChangeNotificationCount > 0" -> %lld
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff70536ad6 __abort_with_payload + 10
1 libsystem_kernel.dylib 0x00007fff705383df abort_with_payload_wrapper_internal + 80
2 libsystem_kernel.dylib 0x00007fff70538411 abort_with_payload + 9
3 libsystem_c.dylib 0x00007fff704a380b _os_crash_fmt.cold.1 + 55
4 libsystem_c.dylib 0x00007fff70436e62 _os_crash_fmt + 154
5 com.apple.AppKit 0x00007fff337796f9 -[NSView(NSInternal) disableGeometryInWindowDidChangeNotification] + 229
6 com.apple.AppKit 0x00007fff33aea004 NSOpenGLContextDetachOffScreenViewSurface + 52
7 com.apple.AppKit 0x00007fff33aabb3b -[NSOpenGLContext update] + 267
8 org.vtk.SimpleCocoaVTK 0x0000000103f0676b vtkCocoaRenderWindow::Start() + 139
9 org.vtk.SimpleCocoaVTK 0x0000000103e426b4 vtkRenderWindow::Render() + 804
10 org.vtk.SimpleCocoaVTK 0x0000000104064adf vtkOpenGLRenderWindow::Render() + 31
11 org.vtk.SimpleCocoaVTK 0x0000000103cf762d -[CustomLayer drawInCGLContext:pixelFormat:forLayerTime:displayTime:] + 509
12 com.apple.QuartzCore 0x00007fff42000a03 CAOpenGLLayerDraw(CAOpenGLLayer*, double, CVTimeStamp const*, unsigned int) + 1956
13 com.apple.QuartzCore 0x00007fff42000084 -[CAOpenGLLayer _display] + 580
14 com.apple.QuartzCore 0x00007fff41f64469 CA::Layer::display_if_needed(CA::Transaction*) + 757
15 com.apple.QuartzCore 0x00007fff41f42716 CA::Context::commit_transaction(CA::Transaction*, double) + 334
16 com.apple.QuartzCore 0x00007fff41f41304 CA::Transaction::commit() + 644
17 com.apple.AppKit 0x00007fff33a5a2fd __28-[NSMoveHelper _doAnimation]_block_invoke + 1014
18 com.apple.AppKit 0x00007fff33905a94 -[NSScreenDisplayLink _fire] + 180
19 com.apple.AppKit 0x00007fff34052d62 ___NSRunLoopTimerCreateWithHandler_block_invoke + 34
20 com.apple.CoreFoundation 0x00007fff3649e9b9 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
21 com.apple.CoreFoundation 0x00007fff3649e51f __CFRunLoopDoTimer + 859
22 com.apple.CoreFoundation 0x00007fff3649e007 __CFRunLoopDoTimers + 322
23 com.apple.CoreFoundation 0x00007fff36482daa __CFRunLoopRun + 1871
24 com.apple.CoreFoundation 0x00007fff36481ffe CFRunLoopRunSpecific + 462
25 com.apple.AppKit 0x00007fff33a597bb -[NSMoveHelper _doAnimation] + 1349
26 com.apple.AppKit 0x00007fff33a62225 -[NSMoveHelper _resizeWindow:toFrame:display:] + 300
27 com.apple.AppKit 0x00007fff3397d10c -[NSWindow setFrame:display:animate:] + 818
28 com.apple.AppKit 0x00007fff33f9dc63 -[NSWindow _zoomToScreen:isMoveToiPad:] + 449
29 com.apple.AppKit 0x00007fff339baecb -[NSTitledFrame _handlePossibleDoubleClickForEvent:] + 234
30 com.apple.AppKit 0x00007fff339ba960 -[NSThemeFrame mouseUp:] + 278
31 com.apple.AppKit 0x00007fff33935969 forwardMethod + 204
32 com.apple.AppKit 0x00007fff33935969 forwardMethod + 204
33 com.apple.AppKit 0x00007fff340c7c1b -[NSTitlebarView mouseUp:] + 261
34 com.apple.AppKit 0x00007fff33935969 forwardMethod + 204
35 com.apple.AppKit 0x00007fff338a6aff -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2738
36 com.apple.AppKit 0x00007fff338a5e29 -[NSWindow(NSEventRouting) sendEvent:] + 349
37 com.apple.AppKit 0x00007fff338a41b4 -[NSApplication(NSEvent) sendEvent:] + 352
38 com.apple.AppKit 0x00007fff336f121f -[NSApplication run] + 707
39 com.apple.AppKit 0x00007fff336c2ff6 NSApplicationMain + 777
40 org.vtk.SimpleCocoaVTK 0x0000000103cf2f62 main + 34
41 libdyld.dylib 0x00007fff703d5cc9 start + 1
The issue is with the rightmost view, which using CALayer instead of NSView for rendering.
The initial attempt to fix this had some side effects that we ended up backing out of: !6653 (merged)
so we need a new solution.
See also: #17832 (closed) !6920 (merged)