0

I've got a crash bug in our game that I've been trying to figure out for a long time, and haven't made much of any progress on. I've got a mostly repeatable set of steps to cause it, I've been able to reproduce it while tethered, figured out what the last bit of my code that's called before it happens. I've set break points and stepped through it... but when the crash happens, it's always just in the assembly and the crash reports always seem to come from within the run loop which isn't very helpful.

Here's how I can reproduce the bug (about 1/3 of the time)...

Enter into the level select screen of the game, with 4/5 levels for the scene completed. The level selector will be on the 5th level. Immediately select level 4. The selector ring will move to the bubble for level 4, and about 1/3 of the time... the bubble for level 5 will just disappear for no apparent reason and the game will crash.

One of the most frustrating things is, it won't always return the same crash report. There are two different versions that will come up.

Hopefully someone can help with this because I'm pretty well stumped.

This is the first one:

Error Message:
Segmentation fault: 11: Application recieved signal

Where:
Tilt, line 0

Backtrace:
Tilt:0:in `0x00086bdf ht_handle_signal + 102'
libsystem_c.dylib:1:in `0x32cf87ed _sigtramp + 48'
UIKit:2:in `0x334e0105 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke_0 + 80'
CoreFoundation:3:in `0x358e77e3 __NSArrayChunkIterate + 318'
CoreFoundation:4:in `0x358e06ff __NSArrayEnumerate + 570'
CoreFoundation:5:in `0x35845ed5 -[NSArray enumerateObjectsWithOptions:usingBlock:] + 64'
UIKit:6:in `0x33338339 -[UIView(Geometry) hitTest:withEvent:] + 668'
UIKit:7:in `0x334e0127 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke_0 + 114'
CoreFoundation:8:in `0x358e77e3 __NSArrayChunkIterate + 318'
CoreFoundation:9:in `0x358e06ff __NSArrayEnumerate + 570'
CoreFoundation:10:in `0x35845ed5 -[NSArray enumerateObjectsWithOptions:usingBlock:] + 64'
UIKit:11:in `0x33338339 -[UIView(Geometry) hitTest:withEvent:] + 668'
UIKit:12:in `0x334e0127 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke_0 + 114'
CoreFoundation:13:in `0x358e77e3 __NSArrayChunkIterate + 318'
CoreFoundation:14:in `0x358e06ff __NSArrayEnumerate + 570'
CoreFoundation:15:in `0x35845ed5 -[NSArray enumerateObjectsWithOptions:usingBlock:] + 64'
UIKit:16:in `0x33338339 -[UIView(Geometry) hitTest:withEvent:] + 668'
UIKit:17:in `0x334e0127 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke_0 + 114'
CoreFoundation:18:in `0x358e77e3 __NSArrayChunkIterate + 318'
CoreFoundation:19:in `0x358e06ff __NSArrayEnumerate + 570'
CoreFoundation:20:in `0x35845ed5 -[NSArray enumerateObjectsWithOptions:usingBlock:] + 64'
UIKit:21:in `0x33338339 -[UIView(Geometry) hitTest:withEvent:] + 668'
UIKit:22:in `0x33337ee7 +[UIWindow _hitTestToPoint:pathIndex:forEvent:] + 314'
UIKit:23:in `0x3331ed43 _UIApplicationHandleEvent + 1226'
GraphicsServices:24:in `0x374df22b PurpleEventCallback + 882'
CoreFoundation:25:in `0x358c0523       __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 38'
CoreFoundation:26:in `0x358c04c5 __CFRunLoopDoSource1 + 140'
CoreFoundation:27:in `0x358bf313 __CFRunLoopRun + 1370'
CoreFoundation:28:in `0x358424a5 CFRunLoopRunSpecific + 300'
CoreFoundation:29:in `0x3584236d CFRunLoopRunInMode + 104'
GraphicsServices:30:in `0x374de439 GSEventRunModal + 136'
UIKit:31:in `0x3334ecd5 UIApplicationMain + 1080'
Tilt:32:in `0x000025df main + 98'
Tilt:33:in `0x00002578 start + 40'

And this is the second one.

Error Message:
Segmentation fault: 11: Application recieved signal

Where:
Tilt1Scene, line 0

Backtrace:
Tilt1Scene:0:in `0x00087a6f ht_handle_signal + 102'
libsystem_c.dylib:1:in `0x33da17ed _sigtramp + 48'
QuartzCore:2:in `0x3540bfd3   _ZN2CA5Layer19collect_animations_EdPdPNS0_21CollectAnimationsDataE + 290'
QuartzCore:3:in `0x3540bfd3 _ZN2CA5Layer19collect_animations_EdPdPNS0_21CollectAnimationsDataE + 290'
QuartzCore:4:in `0x3540bfd3 _ZN2CA5Layer19collect_animations_EdPdPNS0_21CollectAnimationsDataE + 290'
QuartzCore:5:in `0x3540bfd3 _ZN2CA5Layer19collect_animations_EdPdPNS0_21CollectAnimationsDataE + 290'
QuartzCore:6:in `0x3540bfd3 _ZN2CA5Layer19collect_animations_EdPdPNS0_21CollectAnimationsDataE + 290'
QuartzCore:7:in `0x3540bfd3 _ZN2CA5Layer19collect_animations_EdPdPNS0_21CollectAnimationsDataE + 290'
QuartzCore:8:in `0x3540bead _ZN2CA5Layer18collect_animationsEPNS_11TransactionEdPd + 56'
QuartzCore:9:in `0x35405b97 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 1078'
QuartzCore:10:in `0x3540557f _ZN2CA11Transaction6commitEv + 314'
QuartzCore:11:in `0x353fd4b9 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 56'
CoreFoundation:12:in `0x31560b1b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18'
CoreFoundation:13:in `0x3155ed57 __CFRunLoopDoObservers + 258'
CoreFoundation:14:in `0x3155f0b1 __CFRunLoopRun + 760'
CoreFoundation:15:in `0x314e24a5 CFRunLoopRunSpecific + 300'
CoreFoundation:16:in `0x314e236d CFRunLoopRunInMode + 104'
GraphicsServices:17:in `0x329bb439 GSEventRunModal + 136'
UIKit:18:in `0x317e7cd5 UIApplicationMain + 1080'
Tilt:19:in `0x000030c7 main + 98'
Tilt:20:in `0x00003060 start + 40'
  • 1
    This is going to be impossible to solve with the information you've provided. Try enabling Zombies, and updating with the results of that. See http://stackoverflow.com/questions/2190227/how-do-i-setup-nszombieenabled-in-xcode-4 on how to do so – WDUK Jun 09 '12 at 00:56
  • Thanks, I wasn't aware of that functionality.... this is what I got – MidgardSerpent Jun 09 '12 at 01:20
  • 2012-06-08 18:19:52.924 Tilt[3619:707] *** -[StoryCardLevelButton convertPoint:fromView:]: message sent to deallocated instance 0x76576b0 – MidgardSerpent Jun 09 '12 at 01:21
  • 1
    Right, so somewhere, an instance of StoryCardLevelButton is being released somewhere when it shouldn't. Without being able to see the code, all I can suggest is searching your code base on where these sort of objects are being used, how they're allocated/deallocated/retained/released, and whether they match what you expect. You can also use Instruments (through 'Run and Profile' in Xcode) using the 'Allocation' template to see where these objects are being allocated and released (and it'll give you a backtrace at the point of time of retain/release) – WDUK Jun 09 '12 at 01:27
  • Ok, I've used the Allocation tool, and I see when the crash triggers, that's exactly what happens, the Level Button gets deallocated and disappears.... However, there's no obvious reason for it. All deallocation in my code happens in either the ViewDidUnload or Dealloc methods of the view controller. And the deallocation lines for those buttons are already commented out... The profiler shows the Responsible Caller as being [UIView dealloc]... – MidgardSerpent Jun 09 '12 at 01:54
  • so it appears to be being called from the dealloc method of the StoryCardLevelButton itself, which is derived from UIButton. I commented out [super dealloc] from the StoryCardLevelButton dealloc method and that does indeed seem to prevent the crash, but that really doesn't seem like the proper solution to me. The problem is, I can't see any reason why the button would be deallocated at that time. – MidgardSerpent Jun 09 '12 at 01:55

1 Answers1

0

I've found the answer to this question based on the help given above by WDUK.

The problem was being caused by one of the UIButtons on the screen being autoreleased. This was happening because I have a separate property currentSelectedLevelButton which is retained. However, in part of the code I was setting the currentSelectedLevelButton instead of self.currentSelectedLevelButton. Since I wasn't using the property as the setter the retain portion of the property wasn't being used, which then was later autoreleased. Fixing it involved finding all places where I was setting the currentSelectedLevelButton and changing it to self.currentSelectedLevelButton.