SCENARIO 1:
The thread is:
0 - [SRMainWindowController toggleLock:] //self = (SRMainWindowController *)
0x20009d440
1-[NSToolbarButton sendAction:to:]
- (IBAction)toggleLock:(id)sender {
NSError *fetchError = nil;
NSArray *fetchResults;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"Note" inManagedObjectContext:[self managedObjectContext]];
[fetchRequest setEntity:entity];
fetchResults = [[self managedObjectContext]
executeFetchRequest:fetchRequest error:&fetchError];
Note *note = nil;
if (fetchRequest != nil && [fetchResults count] == 1) {
note = [fetchResults objectAtIndex:index]; //note = (Note
*)0x20027bfe0
}
if (note) {
[note setIsEncrypted:[NSNumber numberWithBool:YES]]; // see below
}
}
When I jump into note setIsEncrypted:[NSNumber numberWithBool:YES]]; in the
Note managedObject
self = (Note *)0x20027bfe0 // same as above
value = (NSCFBoolean *) 0x7fff70886280
po self
<Note> uid:319649395851582
category:None
isEncrypted:0
isFlagged:0
(gdb)
- (void)setIsEncrypted:(NSNumber *)value {
[self willChangeValueForKey:@"isEncrypted"];
[self setPrimitiveValue:value forKey:@"isEncrypted"];
[self didChangeValueForKey:@"isEncrypted"];
// see backtrace
}
As soon as I po after the setPrimitive I get:
Breakpoint 26, -[SRMainWindowController toggleLock:] (self=0x20009d440,
_cmd=0x1000a92b1, sender=0x20009d440) at SRMainWindowController.m:2891
2891 if (fetchRequest != nil && [fetchResults count] == 1) {
The program being debugged stopped while in a function called from GDB.
When the function (_NSPrintForDebugger) is done executing, GDB will silently
stop (instead of continuing to evaluate the expression containing
the function call).
#0 -[Note setIsEncrypted:] (self=0x2000b7600, _cmd=0x1000a6eb8,
value=0x7fff70886280) at Note.m:206
#1 0x000000010002d5c9 in -[SRMainWindowController toggleLock:]
(self=0x200078f80, _cmd=0x1000a9239, sender=0x2000a0c20) at
SRMainWindowController.m:2897
#2 0x00007fff83b2afbf in -[NSToolbarButton sendAction:to:] ()
#3 0x00007fff8379c135 in -[NSToolbarItemViewer mouseDown:] ()
#4 0x00007fff8368934f in -[NSWindow sendEvent:] ()
#5 0x00007fff835bea86 in -[NSApplication sendEvent:] ()
#6 0x00007fff835554da in -[NSApplication run] ()
#7 0x00007fff8354e1a8 in NSApplicationMain ()
#8 0x0000000100006b60 in main (argc=1, argv=0x7fff5fbff628) at main.m:13
SCENARIO 2:
I created a second scenario as a test to try to shed more light. Scenario 1
and scenario 2 are **exactly** the same but I'm setting another NSNumber,
isFlagged to YES in the setIsEncrypted accessor and it gets set correctly
without an exception but isEncrypted still causes one.
In SRMainWindowController:
self = (SRMainWindowController *)0x2000df5e0
note = (Note *)0x20027bda0
**** see earlier email for second
part_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]