Actually i'm doing nothing special in setLineFragmentRect... i simply note the fragment and call super's setLineFragmentRect... What i observed is that the a new typesetter gets initialized only when i try to edit the text, and then it goes in to an infinite loop


On 25-Nov-08, at 12:35 AM, Aki Inoue wrote:

NSATSTypesetter trying to create a new instance is a normal behavior.
When the typesetter detects it's being invoked to layout recursively, it instantiates a copy.

The real culprit here is probably at #15 -[TTypesetter setLineFragmentRect:forGlyphRange:usedRect:baselineOffset:] that's triggering the recursive layout.


Aki

On 2008/11/23, at 22:45, chaitanya pandit wrote:

In my application i have an NSTextView with custom NSTextContainer and also a custom NSTypesetter, i have a problem with displaying HTML stuff in the textView. I copied and pasted the entire contents of an html page ( it was news.google.com to be precise), it displays it fine, but whenever i try to edit the text contents, my app goes into an infinite loop.

While debugging i observed a very weird thing, a new typesetter is getting initialized within the "layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments " method.
Any idea about what might be going wrong?
I'd appreciate any help.

Here is the trace(note the  #0):

#0      0x00077a35 in -[TTypesetter init] at TTypesetter.m:25
#1 0x907691a9 in -[NSATSTypesetter layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments :] #2 0x00077c08 in -[TTypesetter layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments :] at TTypesetter.m:95 #3 0x90455f77 in -[NSLayoutManager(NSPrivate) _fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:]
#4      0x905953b6 in _NSFastFillAllLayoutHolesForGlyphRange
#5 0x9051e0ba in -[NSLayoutManager(NSPrivate) _firstPassGlyphRangeForBoundingRect:inTextContainer:okToFillHoles:] #6 0x9051cff1 in -[NSLayoutManager(NSPrivate) _glyphRangeForBoundingRect:inTextContainer:fast:okToFillHoles:] #7 0x9051ce27 in -[NSLayoutManager glyphRangeForBoundingRect:inTextContainer:] #8 0x9051c35e in -[NSTextView setNeedsDisplayInRect:avoidAdditionalLayout:]
#9      0x9051be8b in -[NSTextView setNeedsDisplayInRect:]
#10     0x903be662 in -[NSView setNeedsDisplay:]
#11     0x9051cb82 in -[NSTextView textContainerOrigin]
#12 0x90521b8f in -[NSLayoutManager(NSPrivate) _resizeTextViewForTextContainer:] #13 0x90406ed0 in -[NSLayoutManager(NSPrivate) _updateUsageForTextContainer:addingUsedRect:] #14 0x9045be46 in -[NSLayoutManager setLineFragmentRect:forGlyphRange:usedRect:] #15 0x00078688 in -[TTypesetter setLineFragmentRect:forGlyphRange:usedRect:baselineOffset:] at TTypesetter.m:325 #16 0x90420776 in -[NSATSTypesetter _layoutLineFragmentStartingWithGlyphAtIndex:characterIndex:atPoint:renderingContext :]
#17     0x904583db in -[NSATSTypesetter layoutParagraphAtPoint:]
#18 0x00077ba8 in -[TTypesetter layoutParagraphAtPoint:] at TTypesetter.m:86 #19 0x90400bcd in -[NSTypesetter _layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:maxCharacterIndex:nextGlyphIndex:nextCharacterIndex :] #20 0x909ed6f6 in -[NSTypesetter layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments :] #21 0x90769238 in -[NSATSTypesetter layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments :] #22 0x00077c08 in -[TTypesetter layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments :] at TTypesetter.m:95 #23 0x90455f77 in -[NSLayoutManager(NSPrivate) _fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:]
#24     0x905953b6 in _NSFastFillAllLayoutHolesForGlyphRange
#25 0x90548225 in -[NSTextView(NSPrivate) _ensureLayoutCompleteToEndOfCharacterRange:]
#26     0x90547c81 in -[NSTextView(NSSharing) didChangeText]
#27     0x90543ea2 in -[NSTextView insertText:replacementRange:]
#28     0x905433d3 in -[NSTextView insertText:]
#29 0x90542efa in - [NSKeyBindingManager(NSKeyBindingManager_MultiClients) flushTextForClient:]
#30     0x9054144f in -[NSTSMInputContext interpretKeyEvents:]
#31     0x90540f1a in -[NSView interpretKeyEvents:]
#32     0x90540e2a in -[NSTextView keyDown:]
#33     0x904b13a5 in -[NSWindow sendEvent:]
#34     0x9047d311 in -[NSApplication sendEvent:]
#35     0x903dad0f in -[NSApplication run]
#36     0x903a7f14 in NSApplicationMain
#37     0x000029b0 in main at main.m:12

_______________________________________________

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

This email sent to [EMAIL PROTECTED]


_______________________________________________

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

This email sent to [EMAIL PROTECTED]

Reply via email to