Re: Simple Flipbook Animation?
Re: Simple Flipbook Animation?
- Subject: Re: Simple Flipbook Animation?
- From: Roland King <email@hidden>
- Date: Sun, 02 Nov 2008 12:51:48 +0800
NSArray *redExplode;
NSMutableArray *images;
images = [NSMutableArray array];
CGImageRef im;
UIImage *thisImg;
int p;
//frames ommitted for brevity
redExplode = [[NSArray arrayWithObjects:
[UIImage imageNamed:@"redExlode.00000.png"],
[UIImage imageNamed:@"redExlode.00001.png"],
nil] retain];
for(p = 0;p<[redExplode count];p++)
{
thisImg = [redExplode objectAtIndex: p];
im = thisImg.CGImage;
[images addObject:(id)im];
CGImageRelease (im);
}
why are you releasing the images in the line above? You didn't retain
them. I don't see in the documentation that thisImg.CGImage returns an
image that the caller owns and must release. At some point later on it
looks like the object, or perhaps the UIImage which originally
retained it, it getting released from an autorelease pool and it's
breaking there.
When do you release the redExplode array by the way, you've retained
it here, what releases it again? If you don't release it, you're
leaking it.
You might want to try that NSZombieEnabled flag to see if you can find
what already-freed object you're accessing.
[anim setKeyPath:@"contents"];
[anim setValues:images];
[anim setCalculationMode:@"discrete"];
[anim setRepeatCount:HUGE_VAL];
[[UIAnimator sharedAnimator] addAnimation:anim withDuration:1.5
start:YES];
A backtrace reveals:
#0 0x950886ec in objc_msgSend ()
#1 0x9539d57f in NSPopAutoreleasePool ()
#2 0x953d6974 in __NSFireDelayedPerform ()
#3 0x96c10b45 in CFRunLoopRunSpecific ()
#4 0x96c10cf8 in CFRunLoopRunInMode ()
#5 0x31699d38 in GSEventRunModal ()
#6 0x31699dfd in GSEventRun ()
#7 0x30a5dadb in -[UIApplication _run] ()
#8 0x30a68ce4 in UIApplicationMain ()
#9 0x00002d3c in main (argc=1, argv=0xbfffef68) at /
Developer-3.1.0/Examples/iPhone/MoveMe/main.m:53
The assembly that is crashing is:
0x950886ec <+0028> mov 0x0(ķi),%esi
If I comment out the line "[anim setValues:images];", the program
does not crash.
Any ideas?
Thanks,
Jeshua Lacock
Founder/Programmer
3DTOPO Incorporated
<http://3DTOPO.com>
Phone: 877.240.1364
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden