I have a library which renders fine and without segfaults on arm64 mac and for linux and windows.
I have a QT application which uses this library and works fine for linux and windows but not for mac.
In the library, I take 6 images offscreen. The issue appears to be the same as in the below, where it looks like QT and VTK cannot communicate to deconstruct the renderWindow via vtkCocoaGLView:
https://gitlab.kitware.com/vtk/vtk/-/issues/18559
https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9372
Below is the specific segfault I get (only on mac, when QT and VTK are both used):
==10927==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000d2457 (pc 0x0001042e1fd4 bp 0x00016d8183b0 sp 0x00016d818390 T0)
==10927==The signal is caused by a READ memory access.
#0 0x1042e1fd4 in -[vtkCocoaGLView modifyDPIForBackingScaleFactorOfWindow:]+0x7c (APP_NAME:arm64+0x101d05fd4)
#1 0x1042e2044 in -[vtkCocoaGLView viewWillMoveToWindow:]+0x3c (APP_NAME:arm64+0x101d06044)
#2 0x198fc7fb8 in -[NSView _setWindow:]+0x148 (AppKit:arm64e+0x4dfb8)
#3 0x199a5249c in __21-[NSView _setWindow:]_block_invoke.146+0x108 (AppKit:arm64e+0xad849c)
#4 0x198fc8560 in -[NSView _setWindow:]+0x6f0 (AppKit:arm64e+0x4e560)
#5 0x1991acebc in -[NSWindow dealloc]+0x2a8 (AppKit:arm64e+0x232ebc)
#6 0x196f7e114 in _NSKVOPerformWithDeallocatingObservable+0xa8 (Foundation:arm64e+0x751114)
#7 0x19689b400 in NSKVODeallocate+0xb0 (Foundation:arm64e+0x6e400)
#8 0x1952a7c8c in AutoreleasePoolPage::releaseUntil(objc_object**)+0xd0 (libobjc.A.dylib:arm64e+0xfc8c)
#9 0x1952a42f8 in objc_autoreleasePoolPop+0x100 (libobjc.A.dylib:arm64e+0xc2f8)
#10 0x1957147a0 in _CFAutoreleasePoolPop+0x1c (CoreFoundation:arm64e+0x3c7a0)
#11 0x195828090 in __CFRunLoopPerCalloutARPEnd+0x2c (CoreFoundation:arm64e+0x150090)
#12 0x195756488 in __CFRunLoopDoSource0+0xcc (CoreFoundation:arm64e+0x7e488)
#13 0x1957561d8 in __CFRunLoopDoSources0+0xf0 (CoreFoundation:arm64e+0x7e1d8)
#14 0x195754dc4 in __CFRunLoopRun+0x338 (CoreFoundation:arm64e+0x7cdc4)
#15 0x195754430 in CFRunLoopRunSpecific+0x25c (CoreFoundation:arm64e+0x7c430)
#16 0x196888a84 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:]+0xd0 (Foundation:arm64e+0x5ba84)
#17 0x1968fdf9c in -[NSRunLoop(NSRunLoop) runUntilDate:]+0x60 (Foundation:arm64e+0xd0f9c)
#18 0x199243184 in NSCoreDragReceiveMessageProc+0xd0 (AppKit:arm64e+0x2c9184)
#19 0x19bb7ba04 in CallReceiveMessageCollectionWithMessage+0x70 (HIServices:arm64e+0x1aa04)
#20 0x19bb75b04 in DoMultipartDropMessage+0xc8 (HIServices:arm64e+0x14b04)
#21 0x19bb75858 in DoDropMessage+0x34 (HIServices:arm64e+0x14858)
#22 0x19bb795ec in CoreDragMessageHandler+0x398 (HIServices:arm64e+0x185ec)
#23 0x1957f30fc in __CFMessagePortPerform+0x250 (CoreFoundation:arm64e+0x11b0fc)
#24 0x195756a68 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__+0x38 (CoreFoundation:arm64e+0x7ea68)
#25 0x195756988 in __CFRunLoopDoSource1+0x208 (CoreFoundation:arm64e+0x7e988)
#26 0x19575534c in __CFRunLoopRun+0x8c0 (CoreFoundation:arm64e+0x7d34c)
#27 0x195754430 in CFRunLoopRunSpecific+0x25c (CoreFoundation:arm64e+0x7c430)
#28 0x19fef8198 in RunCurrentEventLoopInMode+0x120 (HIToolbox:arm64e+0x33198)
#29 0x19fef7fd4 in ReceiveNextEventCommon+0x284 (HIToolbox:arm64e+0x32fd4)
#30 0x19fef7d2c in _BlockUntilNextEventMatchingListInModeWithFilter+0x48 (HIToolbox:arm64e+0x32d2c)
#31 0x198fb3d64 in _DPSNextEvent+0x290 (AppKit:arm64e+0x39d64)
#32 0x1997a9804 in -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]+0x2b8 (AppKit:arm64e+0x82f804)
#33 0x198fa7098 in -[NSApplication run]+0x1d8 (AppKit:arm64e+0x2d098)
#34 0x11133e674 (libqcocoa.dylib:arm64+0x3a674)
#35 0x10ac1eb04 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)+0x21c (QtCore:arm64+0x1ceb04)
#36 0x10ac22c4c in QCoreApplication::exec()+0x80 (QtCore:arm64+0x1d2c4c)
#37 0x1025fd7bc in exec(int, char**, QStringList const&, QString&) main.cpp:1558
#38 0x102604b7c in main main.cpp:1575
#39 0x1952ee0dc (<unknown module>)
==10927==Register values:
x[0] = 0x000000010eeb8700 x[1] = 0x0000000000000090 x[2] = 0x00000001fd4f3b20 x[3] = 0x0000000000000001
x[4] = 0x0000000000000000 x[5] = 0x0000000000000001 x[6] = 0x000000016d028000 x[7] = 0x0000000000000001
x[8] = 0x00000000000d2237 x[9] = 0x0000000000000103 x[10] = 0x0000000000731ef2 x[11] = 0x000000000000004a
x[12] = 0x000000014fd465a0 x[13] = 0x0000000000000000 x[14] = 0x0200000104d18dbf x[15] = 0x0000000104d18db8
x[16] = 0x0000000104d18dba x[17] = 0x00000001042e1498 x[18] = 0x0000000000000000 x[19] = 0x0000000123424380
x[20] = 0x0000000000000000 x[21] = 0x00000001fd9fe000 x[22] = 0x0000000000000003 x[23] = 0x00000000000000a0
...
SUMMARY: AddressSanitizer: SEGV (APP_NAME:arm64+0x101d05fd4) in -[vtkCocoaGLView modifyDPIForBackingScaleFactorOfWindow:]+0x7c
Note: Using Qt 5.15, VTK 6.3
Any help on resolving this issue, or at least working around it, would be great. Thanks.