开发者

app crashes when IKSlideshow terminates; so does a simple example app

I have a fairly small app that shows photos stored on a web server that crashes when the slideshow part of it terminates. I use IKSlideshow. To illustrate the problem, I wrote a new app that doesn't do anything else, and it crashes, too. Here's the new app. Most of the code was generated automatically by Xcode 4. Using the 10.6 SDK, targetted for 10.6, running on 10.6, LLVM 2.0 compiler, 64 bit. Tried 32-bit, LLVM GCC 4.2, 10.5 SDK all in different combinations, and same thing.

Here's the header file:

#import <Cocoa/Cocoa.h>
#import <Quartz/Quartz.h>

@interface SlideshowTestAppDelegate : NSObject <NSApplicationDelegate, IKSlideshowDataSource> {
@private
    NSWindow *window;
}

@property (assign) IBOutlet NSWindow *window;
- (IBAction)action:(id)sender;

@end

and here's the implementation file:

#import "SlideshowTestAppDelegate.h"

@implementation SlideshowTestAppDelegate

@synthesize window;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
}

- (NSUInteger)numberOfSlideshowItems
{
    return 20;
}

- (id)slideshowItemAtIndex:(NSUInteger)index
{
    static NSURL *url = nil;
    if (url == nil)
        url = [[NSURL URLWithString:@"http://basepath.com/galleries/Anne%20U.%20White%20Trail/MJR_20070519_0537.jpg"] retain];
    return url; // show the same image over and over
}

- (IBAction)action:(开发者_C百科id)sender
{
    [[IKSlideshow sharedSlideshow] runSlideshowWithDataSource:self inMode:IKSlideshowModeImages options:[NSDictionary dictionary]];
}

@end

To start the slideshow, you choose File-New, which invokes the action method. Then, while the slideshow is running (it starts paused) you click the right arrow on the the slideshow on-screen controls 10 times as quickly as you can, and then type Esc or click the X. App crashes every time. Info when it crashes varies, but several times it crashes with this message on the console:

SlideshowTest(3882,0x7fff702e6ca0) malloc: * error for object 0x10056f110: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug

But the diagnostic output I get when it crashes isn't consistent.

I use the same image for all 20 slides only to make this example easy to follow. In my actual application, the slides are all different.

Even if you do click ahead rapidly, the slideshow should not crash. I don't expect my users to do that, but in my actual app it crashes the app after just running for a while (10 min. say), never when the slideshow is actually running, but only when I quit it. (No clicking ahead; again, that's just a way I came up with to reproduce the crash easily.)

This is such a simple app that it's hard for me to believe that there is any data being allocated by me incorrectly or anything not retained.

Has anyone else had problems with IKSlideshow crashing? Anyone see anything I'm not seeing?

Thanks!

Marc

UPDATE: Thinking that maybe the slideshow delegate and the app delegate should not be the same object, I created a new object to serve only as the slideshow delegate, instantiated that and used it. Same crash as before.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜