My app has a window with many text fields and a button. The value in each text 
field is bound to Shared Defaults. Clicking the button reads from the defaults 
and generates text which is written to a text field in a second window.

The app launches with the previously used values in the text fields (as 
desired). Immediately clicking the button works fine--text is generated as 
expected. But if I change the value in a text field before clicking the button, 
the app crashes. (This happens whether or not I first tab out of the field to 
commit the edit before clicking the button.) The error is:

-[CFString release]: message sent to deallocated instance 0x164d7fd0

That leads to:

Call [2] [arg=32]: thread_a0871720 |start | main | NSApplicationMain | 
-[NSApplication run] | -[NSApplication sendEvent:] | -[NSWindow sendEvent:] | 
-[NSTextView keyDown:] | -[NSView interpretKeyEvents:] | -[NSTSMInputContext 
interpretKeyEvents:] | -[NSKeyBindingManager(NSKeyBindingManager_MultiClients) 
interpretEventAsCommand:forClient:] | -[NSTextView doCommandBySelector:] | 
-[NSResponder doCommandBySelector:] | -[NSTextView(NSKeyBindingCommands) 
insertTab:] | -[NSTextView(NSPrivate) _giveUpFirstResponder:] | -[NSWindow 
makeFirstResponder:] | -[NSTextView(NSSharing) resignFirstResponder] | 
-[NSTextField textShouldEndEditing:] | -[_NSBindingAdaptor 
validateAndCommitValueInEditor:editingIsEnding:errorUserInterfaceHandled:] | 
-[_NSBindingAdaptor 
_validateAndCommitValueInEditor:editingIsEnding:errorUserInterfaceHandled:bindingAdaptor:]
 | -[NSValueBinder 
validateAndCommitValueInEditor:editingIsEnding:errorUserInterfaceHandled:] | 
-[NSValueBinder 
_applyDisplayedValueIfHasUncommittedChangesWithHandleErrors:typeOfAlert:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
 | -[NSValueBinder 
applyDisplayedValueHandleErrors:typeOfAlert:canRecoverFromErrors:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
 | -[NSActionCell objectValue] | -[NSControl validateEditing] | -[NSCell 
setStringValue:] | -[NSCell _objectValue:forString:] | -[NSCell 
_objectValue:forString:errorDescription:] | -[NSPlaceholderString 
initWithString:] | CFStringCreateWithCharactersNoCopy | 
__CFStringCreateImmutableFunnel3 | _CFRuntimeCreateInstance | malloc_zone_malloc

I tried adding [myWindow makeFirstResponder:nil] at the beginning of the 
button's action but that didn't work. The odd thing is that the crash only 
affects certain text fields and not others. (All are identical except for their 
Model Key Paths.) I'm a bit of an amateur and any help would be most 
appreciated. 
Thanks,
John


      
_______________________________________________

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]

Reply via email to