spritebuilder / SpriteBuilder

Objective-C Game Development Suite
http://www.spritebuilder.com/
Other
740 stars 293 forks source link

CCEffects Crashed on iPhone4s with iOS 8.2 #1523

Open RunningAfro opened 9 years ago

RunningAfro commented 9 years ago

1.Create new project using SpriteBuilder, open it in Xcode. 2.In MainScene.m, add an onEnter function like below:

- (void)onEnter{

    [super onEnter];

    CCSprite *sp = [CCSprite spriteWithImageNamed:@"ccbResources/ccbButtonNormal.png"];

    CGSize winSize = [CCDirector sharedDirector].viewSize;

    sp.position = ccp(winSize.width / 2, winSize.height / 2);

    [self addChild:sp];

    sp.effect = [CCEffectBrightness effectWithBrightness:0.4];

}

3.Run this project on a iPhone4s device with iOS 8.2.

--Result: Crash: ''error: memory read failed for 0x0"

--Expect Result: No crash.

SpriteBuilder: 1.4.9 Xcode: 6.3 (6D570) Device: iPhone4s / iOS 8.2(12D508)

RunningAfro commented 9 years ago

PS: I made some further test, and these informations maybe useful: http://forum.cocos2d-spritebuilder.org/t/cceffectbrightness-crashed-on-iphone4s/17124/3

EnlightenedOne commented 9 years ago

That link is dead and just goes to the forum, I am also experiencing this problem on iOS 8.3 when adding a Lighting value to a CCSprite. The error only shows up on a real device (4S) not the emulator. The exception is triggered from "CCEffectRenderer::drawSprite" i think the line number is 275:

renderPassInputs.verts = padVertices(sprite.vertexes, effect.padding, tc1, tc2);

Setting the value directly after the CCEffectRenderPassInputs object is created causes the error so presumably there is something wrong with the actual data structure working against the device. You do not get a stack trace when the exception hits "error: memory read failed for 0x0" Thread 1:EXC_BAD_ACCESS (code=1 address 0x0).

All my versioning is the same, the exception was not present for me using Xcode 6.2 (6C131e) and iOS 8.2 on my device. I upgraded both at the same time so cannot qualify which caused the issue.

thayerandrews commented 9 years ago

There is more information about this crash in the following Cocos2D issue: https://github.com/cocos2d/cocos2d-objc/issues/1301

The problem appears to be with Xcode 6.3 and 32 bit devices but we've committed a workaround to CCEffects to get everything working until the underlying problem is fixed by Apple.

EnlightenedOne commented 9 years ago

thank you very much for the redirect, quite shocked by the nature of the error on exposing the struct different ways to get a more refined handle on the corruption as it happens. You have to worry when the compiler has problems. I thought I was just being an amateur, I have never seen an exception manifest like that before.