EXC_BAD_ACCESS in CALayerCollectLayers_ on iPhone
When working on a device:
Program received signal: "EXC_BAD_ACCESS".
Debugger:
#0 0x31e11158 in CALayerCollectLayers_
#1 0x31e11180 in CALayerCollectLayers_
#2 0x31e11180 in CALayerCollectLayers_
#3 0x31dd7428 in CALayerDisplayIfNeeded
#4 0x31dd5780 in CAContextCommitTransaction
#5 0x31dd543c in CATransactionCommit
#6 0x3026a0ec in __CFRunLoopDoObservers
#7 0x30269418 in CFRunLoopRunSpecific
#8 0x30269326 in CFRunLoopRunInMode
#9 0x306941fe in -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
#10 0x30694f9a in -[NSRunLoop(NSRunLoop) run]
#11 0x0000319e in -[AppController createInStreamThread] at AppController.m:395
#12 0x30672e08 in -[NSThread main]
#13 0x30672cd6 in __NSThread__main__
#14 0x3146178c in _pthread_body
When working in the simulator:
modifying layer that is being finalized - 0x52f2b0
+1
a source to share
2 answers
This type of defect can be difficult to track down. I'm glad you found it so quickly. Fortunately, there are some helpful tools to help you.
first of all use clang static language analysis , it can find this defect without you running the code.
If you click this defect after that, enable NSZombies , MallocStackLogging and MallocStackLoggingNoCompact, then use malloc_history to find where the allocation was done. It's not perfect, but it's a big help.
+3
a source to share