**

I have a button to trigger the popover, and a checkbox on the popover. The
state checkbox of the checkbox is bound to a field 'checkboxState' of an
NSManagedObject.

Here is the scenario:

   1. I click the button, the popover will show up.
   2. I check the checkbox on the popover, then the popover becomes larger
   and some other views are shown (if I uncheck the checkbox, the views will
   be hidden, and the popover goes back to the original size). *The
   checkboxState is YES here*
   3. I close the popover, and do some other stuff which will *change the
   checkboxState to NO*.
   4. I click the button again, then the app hangs for about 10 seconds and
   the xcode throws EXC_BAD_ACCESS(code=2, address=0x7fff5f3ffff8), the caller
   is 0_CFArrayReplaceValues

*The app doesn't die, it just doesn't respond.*

The button's action is as following:

- (IBAction)showPopover:(id)sender {
    if (!_myPopover) {
        _myPopover = [[NSPopover alloc] init];
        _myPopover.delegate = self;
        _myPopover.contentViewController = self;
        _myPopover.animates = YES;
        _myPopover.behavior = NSPopoverBehaviorSemitransient;
        _myPopover.appearance = NSPopoverAppearanceMinimal;
    }

    id theManagedObject = self.myArrayController.selection;
    BOOL state = [[theManagedObject valueForKey:@"checkboxState"] boolValue];

    if (state) {
        _myPopover.contentSize = NSMakeSize(360, 340);
        [self.view1 setHidden:NO];
        [self.view2 setHidden:NO];
    }
    else {
        [self.view1 setHidden:YES];
        [self.view2 setHidden:YES];
        _myPopover.contentSize = NSMakeSize(360, 270);
    }

    [_myPopover showRelativeToRect:[sender bounds] ofView:sender
preferredEdge:NSMaxYEdge];}

The code that changes the checkboxState of the object is: [anManagedObject
setValue:@NO forKey:@"checkboxState"]

If I comment the _myPopover.contentSize = NSMakeSize(360, 270) in
showPopover; it will work.

If I comment the [anManagedObject setValue:@NO forKey:@"checkboxState"] ,
it will work

I used @try @catch, no error thrown. I used the Profile tool, it seems the
app goes into an infinite loop, and the memory usage goes up very quickly.
The possible callers that cause this are[NSLayoutConstaint
_loweredExpressionReportingConstantIsRounded:]
and[NSIsObjectiveLinearExpression
replaceVariable:withExpression:processVariableNewToReceiver:processVariableDroppedFromReceiver:]

Any ideas? I have been stuck at this problem for a day. Really need to
solve this.
_______________________________________________

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

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

Reply via email to