Dear list,

I have a core-data entity which has a derived read only property declared as 
below.

I then have a search field on the UI with a predicate bound to the array 
controller for the entity with the predicate format being:

"contentString contains $value"

When I run this the app crashes and I get the following back-trace from gdb:

Program received signal:  “EXC_BAD_ACCESS”.
sharedlibrary apply-load-rules all
(gdb) bt
#0  0x00007fff8665611c in objc_msgSend ()
#1  0x00007fff86add30a in -[NSInPredicateOperator 
performPrimitiveOperationUsingObject:andObject:] ()
#2  0x00007fff86a4055d in -[NSComparisonPredicate 
evaluateWithObject:substitutionVariables:] ()
#3  0x00007fff86a403a2 in _filterObjectsUsingPredicate ()
#4  0x00007fff86a7853a in -[NSMutableArray(NSPredicateSupport) 
filterUsingPredicate:] ()
#5  0x00007fff817ce4b9 in -[NSArrayController _filterObjects:] ()
#6  0x00007fff817bf07f in -[NSArrayController 
_arrangeObjectsWithSelectedObjects:avoidsEmptySelection:operationsMask:useBasis:]
 ()
#7  0x00007fff817c718d in -[NSArrayController setFilterPredicate:] ()
#8  0x00007fff86a1a429 in -[NSObject(NSKeyValueCoding) setValue:forKey:] ()
#9  0x00007fff86a78f2e in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] ()
#10 0x00007fff817d37ad in -[NSBinder 
_setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error:]
 ()
#11 0x00007fff817d3665 in -[NSBinder setValue:forBinding:error:] ()
#12 0x00007fff81bd50e4 in -[NSViewStateBinder 
_setValue:forBinding:errorFallbackMessage:] ()
#13 0x00007fff81ab5867 in -[NSSearchFieldBinder performAction:] ()
#14 0x00007fff817eaf37 in -[_NSBindingAdaptor 
_objectDidTriggerAction:bindingAdaptor:] ()
#15 0x00007fff8175efda in -[NSControl sendAction:to:] ()
#16 0x00007fff81ab6080 in -[NSSearchFieldCell(NSSearchFieldCell_Local) 
_sendPartialString] ()
#17 0x00007fff86a60a39 in __NSFireTimer ()
#18 0x00007fff83e2aa58 in __CFRunLoopRun ()
#19 0x00007fff83e28c2f in CFRunLoopRunSpecific ()
#20 0x00007fff87207a4e in RunCurrentEventLoopInMode ()
#21 0x00007fff872077b1 in ReceiveNextEventCommon ()
#22 0x00007fff8720770c in BlockUntilNextEventMatchingListInMode ()
#23 0x00007fff8160a1f2 in _DPSNextEvent ()
#24 0x00007fff81609b41 in -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#25 0x00007fff815cf747 in -[NSApplication run] ()
#26 0x00007fff815c8468 in NSApplicationMain ()

Can anyone see what I'm doing wrong (assuming it's my fault, and not a bug) ? 
Alternatively, anyone got a good idea how to debug this?

Best wishes,

Martin

@property (readonly) NSString* contentString;

- (NSString*)contentString
{
        NSData *data = [self valueForKey:@"content"];
        if (!data || [data length] == 0)
                return @"";
                
        NSAttributedString *attStr = [[NSAttributedString alloc] 
initWithRTFD:data
                                                                                
                                                                                
                                                 documentAttributes:nil];
        if (!attStr)
                return @"";
        
        NSString *contentStr = [attStr string];
        [attStr release];
        
        return contentStr;      
}

+ (NSSet *)keyPathsForValuesAffectingContentString
{
        return [NSSet setWithObject:@"content"];
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
    Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to