我的窗口正在加载时发生崩溃(下面的回溯)。似乎暗示Core Animation发生了某些事情,但我没有启动任何动画,只是显示了窗口。
将特定堆栈视图的剪切阻力从1000更改为750可以避免一小段时间的崩溃,但现在又回来了,尽管它现在发生在另一个点。
我尝试创建布局的简化版本以在此处演示该问题,但无法重现该问题。因此,我所能做的就是将您引荐至完整的应用程序:https://github.com/Uncommon/Xit/tree/0b70352239b6fbaba6d26c952ce6de4f111a5346
崩溃回溯:
#0 0x00007fff4339c454 in -[NSApplication _crashOnException:] ()
#1 0x00007fff43968cb1 in __65+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayRefresh]_block_invoke ()
#2 0x00007fff45af4417 in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#3 0x00007fff45af433f in __CFRunLoopDoObservers ()
#4 0x00007fff45ad68b8 in __CFRunLoopRun ()
#5 0x00007fff45ad6153 in CFRunLoopRunSpecific ()
#6 0x00007fff44dc0d96 in RunCurrentEventLoopInMode ()
#7 0x00007fff44dc0a0f in ReceiveNextEventCommon ()
#8 0x00007fff44dc0884 in _BlockUntilNextEventMatchingListInModeWithFilter ()
#9 0x00007fff43071a73 in _DPSNextEvent ()
#10 0x00007fff43807e34 in -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] ()
#11 0x00007fff43066885 in -[NSApplication run] ()
#12 0x00007fff43035a72 in NSApplicationMain ()
#13 0x0000000100005794 in main at /Users/i58922/Developer/Personal/Xit/Xit/main.m:5
#14 0x00007fff6d91d015 in start ()
#15 0x00007fff6d91d015 in start ()
在这种情况下,可能的罪魁祸首是什么?如何缩小范围?这是一个有点复杂的窗口,带有嵌套的拆分视图等。
答案 0 :(得分:0)
我最终将其范围缩小到以下事实:我正在调用tableView.view(atColumn:,row:,makeIfNecessary:)
且行索引超出范围。这会导致异常,然后在崩溃之前将堆栈解绕到无法识别的位置。
如果我打开“所有Objective-C异常”断点,我会发现它更快,因为断点在[NSApplication _crashOnException:]
中崩溃应该是显而易见的事情。