calimarkus/JDFlipNumberView

CALayerInvalidGeometry crash in JDFlipNumberDigitView.m

johnboiles opened this issue · 1 comments

I'm seeing an intermittent crash. Here's what it's looks like:

Fatal Exception: CALayerInvalidGeometry
CALayer position contains NaN: [32.5 nan]

Thread : Fatal Exception: CALayerInvalidGeometry
0  CoreFoundation                 6495280712 __exceptionPreprocess
1  libobjc.A.dylib                6770999524 objc_exception_throw
2  CoreFoundation                 6495280520 -[NSException initWithCoder:]
3  QuartzCore                     6563416432 CA::Layer::set_position(CA::Vec2<double> const&, bool)
4  QuartzCore                     6563416264 -[CALayer setPosition:]
5  QuartzCore                     6563416152 -[CALayer setFrame:]
6  UIKit                          6570418116 -[UIView(Geometry) setFrame:]
7  MyApp                          4297676208 -[JDFlipNumberDigitView setFrame:] (JDFlipNumberDigitView.m:159)
8  MyApp                          4297690220 -[JDFlipNumberView layoutSubviews] (JDFlipNumberView.m:495)
9  UIKit                          6570433068 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
10 QuartzCore                     6563453332 -[CALayer layoutSublayers]
11 QuartzCore                     6563431780 CA::Layer::layout_if_needed(CA::Transaction*)
12 QuartzCore                     6563431432 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
13 QuartzCore                     6563429384 CA::Context::commit_transaction(CA::Transaction*)
14 QuartzCore                     6563428748 CA::Transaction::commit()
15 UIKit                          6570441032 _UIApplicationHandleEventQueue
16 CoreFoundation                 6494986472 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
17 CoreFoundation                 6494983052 __CFRunLoopDoSources0
18 CoreFoundation                 6494975036 __CFRunLoopRun

I've gotten this a handful of times on several devices (iPhone 5s, 6, 6s) on both iOS8 and 9.1. It's super intermittent so I haven't been able to reproduce in the debugger.

Seems like the things that affect CALayer's position are bounds, anchorPoint, and possibly transform. Though I haven't been able to figure out where a division by zero could have happened for any of those. I'll post here if I make any progress in diagnosing this.

I can reproduce semi-reliably by mashing cmd-shift-m to trigger memory warnings around the time JDFlipNumberView is laying out. Fixed in #45