From: Javier S. <jav...@ri...> - 2007-10-08 10:32:05
|
Hi All, I'm running into trouble while working with bindings. I setup the default value of a popup button, taken from the user defaults system. The contents for the popups comes from an array controller which in turn gets the values from the user defaults controller. When the user selects a different value, the app crashes with a retain exception. If I do not setup a default value, or if the user does not select a different option the code won't crash. I don't think I'm doing anything perverse, but any tip will be appreciated. This is the code that causes the problem: def windowControllerDidLoadNib(aController) super_windowControllerDidLoadNib(aController) arr = OSX::NSUserDefaults.standardUserDefaults.arrayForKey ("ListaAgentes") setDiccionarioAgenteSeleccionado(arr.objectAtIndex(0)) if arr This is the stack trace: #0 0x907c05c4 in CFRetain #1 0x92c67758 in _NSKeyValueObservationInfoCreateByRemoving #2 0x92c67530 in -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:] #3 0x92c67420 in -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:] #4 0x92c68088 in -[NSKeyValueObservationForwarder observeValueForKeyPath:ofObject:change:context:] #5 0x92befad8 in -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] #6 0x92c99d10 in _NSSetValueAndNotifyForUndefinedKey #7 0x92c6a728 in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] #8 0x939f2b1c in -[NSBinder _setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotAppli cableKeys:error:] #9 0x939f29a4 in -[NSBinder setValue:forBinding:error:] #10 0x93c664a8 in -[NSValueBinder _applyObjectValue:forBinding:canRecoverFromErrors:handleErrors:typeOfAle rt:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert: ] #11 0x93c66904 in -[NSValueBinder applyDisplayedValueHandleErrors:typeOfAlert:canRecoverFromErrors:discard EditingCallback:otherCallback:callbackContextInfo:didRunAlert:] #12 0x93c67508 in -[NSValueBinder performAction:] #13 0x93c53310 in -[_NSBindingAdaptor _objectDidTriggerAction:bindingAdaptor:] #14 0x938e5c40 in -[NSPopUpButtonCell _popUpItemAction:] #15 0x9383fc4c in -[NSApplication sendAction:to:from:] #16 0x9389a4b8 in -[NSMenu performActionForItemAtIndex:] #17 0x9389a23c in -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] #18 0x938c2d6c in _NSPopUpCarbonMenu2 #19 0x938c23ac in _NSPopUpCarbonMenu1 #20 0x938c2368 in -[NSCarbonMenuImpl popUpMenu:atLocation:width:forView:withSelectedItem:withFont:] #21 0x938c2008 in -[NSPopUpButtonCell trackMouse:inRect:ofView:untilMouseUp:] #22 0x93859094 in -[NSControl mouseDown:] #23 0x937fa890 in -[NSWindow sendEvent:] #24 0x937a38d4 in -[NSApplication sendEvent:] #25 0x9379ad10 in -[NSApplication run] #26 0x9388b87c in NSApplicationMain #27 0x0004224c in ffi_call_DARWIN #28 0x00041d84 in ffi_call #29 0x0003fbcc in rb_ffi_dispatch |