Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Core Animation/Core Image Crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Animation/Core Image Crash



Hi all,

In our application we have a window with a layer-backed NSView which has a content filter applied. The view also has a CAAnimation attached, which alters one of the filter's parameters.

Our problem is: When we repeatedly close and re-open the window, the application crashes. (Note that the window's isReleasedWhenClosed flag is not set!) We broke down our setup to the following code, which always causes a crash after opening and closing the window a few times:


@implementation MyView

- (void) drawRect: (NSRect) dirtyRect
{
    [[NSColor greenColor] set];
    NSRectFill( [self bounds] );
}

@end

@implementation MyController

- (void) toggleWindow: (NSWindow*) window
{
    if ( [window isVisible] ) {
        [window close];
    } else {
        [window makeKeyAndOrderFront:self];
    }

[self performSelector:@selector(toggleWindow:) withObject:window afterDelay:0.2];
}


- (void) awakeFromNib
{
NSWindow* window = [[NSWindow alloc] initWithContentRect:NSMakeRect( 0.0, 0.0, 500.0, 300.0 )
styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO]; // not released
[window setReleasedWhenClosed:NO];
[window center];
[[window contentView] setWantsLayer:YES];


MyView* view = [[MyView alloc] initWithFrame:NSMakeRect( 20.0, 20.0, 200.0, 100.0 )];
[[window contentView] addSubview:view];
[view release];


    CIFilter* bloomFilter = [CIFilter filterWithName:@"CIBloom"];
    [bloomFilter setDefaults];
    [bloomFilter setName:@"bloomFilter"];
    [view setContentFilters:[NSArray arrayWithObject:bloomFilter]];

CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"filters.bloomFilter.inputRadius"];
animation.fromValue = [NSNumber numberWithFloat:0.0];
animation.toValue = [NSNumber numberWithFloat:10.0];
animation.repeatCount = FLT_MAX;
[[view layer] addAnimation:animation forKey:@"theAnimation"];


    [self toggleWindow:window];
}

@end


We've already tried removing the filter and animation before the window closes (by listening to the NSWindowWillCloseNotification), but this only seems to delay the crash a bit.


Does anybody have a clue what's wrong here? Thanks in advance.

Simon Haertel
_______________________________________________

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




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.