Angry Chipmunks (vanilla) crash on CCSprite -initWithTexture

Discuss any Chipmunk bugs here.
Post Reply
omnius
Posts: 16
Joined: Sat Nov 26, 2011 1:09 pm
Contact:

Angry Chipmunks (vanilla) crash on CCSprite -initWithTexture

Post by omnius »

Unchanged version of "Angry Chipmunks", crashes after a few dozen fast clicks and rotations with:

Code: Select all

-(id) initWithTexture:(CCTexture2D*)texture rect:(CGRect)rect
{
	NSAssert(texture!=nil, @"Invalid texture for sprite");
	// IMPORTANT: [self init] and not [super init];
	if( (self = [self init]) )
	{
		[self setTexture:texture];
		[self setTextureRect:rect];
	}
	return self;
}
The NSAssert crashes. This is reproducible very single time. Running in IOS 5 simulator with Xcode 4.2, otherwise completely vanilla Angry Chipmunks.

Not a good sign? The backtrace goes up to:

Code: Select all

// When a breakable box touches ground (which is set to the default/nil collision type) you win.
- (void)PostSolve_Default_BreakableBox:(cpArbiter *)arbiter space:(ChipmunkSpace*)space
{
	CHIPMUNK_ARBITER_GET_SHAPES(arbiter, unused, box);
	BreakableApplyDamage(box.data, arbiter, self);
}
And then some assembly code. Clearly the Macro or the library itself is passing a nil box.sprite.batchNode.texture only some precent of the time, indicating an unstable library?

Thanks.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Angry Chipmunks (vanilla) crash on CCSprite -initWithTex

Post by slembcke »

Oh, whoops. Looks like I'm trying to initialize the broken box pieces using a sprite that is already been removed from the sprite batch node. Only happens when a box is impacted by multiple cages when it breaks (I think). I'll look into it tomorrow afternoon.

Anyway, definitely a bug, just not a Chipmunk bug. Thanks for the heads up.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests