Re: Over-release *inside* framework when setting NSTextView attributes
Re: Over-release *inside* framework when setting NSTextView attributes
- Subject: Re: Over-release *inside* framework when setting NSTextView attributes
- From: Robert Clair <email@hidden>
- Date: Tue, 14 Jun 2005 13:50:43 -0400
Douglas -
I will certainly check this out, but I'm puzzled. If I put in my own
[NSDictionary isEqualToDictionary:] and put a break there, it reports
its argument to of type NSZombie_NSAttributeDictionary. I have no
direct control over NSAttributeDictionary it is an internal AppKit
class - how is it turning into a zombie on me ?
On further probing this only happens with the shadow attribute - it
happens when I enter a character with a shadow, select it and then go
and change the shadow. It doesn't happen going through the same
branch of code with color or font, etc.
for j o a r
It is a single threaded application. This is the routine. It is
called from a routine that watches for notifications of changes in an
object that mediates graphics state between the UI and the tools.
- (void) changeAttributes:(NSDictionary*) newAttributes
withActionName: (NSString*) actionName
{
NSMutableDictionary* newTypingAttributes =
[NSMutableDictionary dictionaryWithDictionary: [self
typingAttributes]];
// NSTextView doesn't have "addTypingAttributes"
[newTypingAttributes addEntriesFromDictionary: newAttributes];
BOOL removeShadow =
[[newTypingAttributes objectForKey: NSShadowAttributeName]
isEqual: [NSNull null]];
if ( removeShadow )
{
[newTypingAttributes removeObjectForKey: NSShadowAttributeName];
}
[super setTypingAttributes: newTypingAttributes];
NSRange selectedRange = [self selectedRange];
if ( selectedRange.length <= 0 ) return;
[[self textStorage] beginEditing];
//THIS IS THE LINE THAT CRASHES IT
[[self textStorage] addAttributes: newAttributes
range: selectedRange];
if (removeShadow )
{
[[self textStorage] removeAttribute: NSShadowAttributeName
range: selectedRange];
}
[[self textStorage] endEditing];
[self postCoalescedAttributeChangeNotificationWithName: actionName];
}
.....Bob Clair
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden