Re: Help me fix a bug: endless recursion in NSTextView?
Re: Help me fix a bug: endless recursion in NSTextView?
- Subject: Re: Help me fix a bug: endless recursion in NSTextView?
- From: Ken Thomases <email@hidden>
- Date: Fri, 08 Feb 2013 09:11:53 -0600
On Feb 8, 2013, at 5:05 AM, Oleg Krupnov wrote:
> I've received a few reports from users that my app hangs and consumes
> 100% CPU, and they have to force quit it. It usually happens on
> MacBooks after they are awaken from sleep mode.
>
> One user also sent the following crash report:
>
> 16 com.apple.CoreFoundation 0x00007fff8846547a
> _CFXNotificationPost + 2554
> 17 com.apple.Foundation 0x00007fff85251846
> -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
> 18 com.apple.AppKit 0x00007fff8cb8821e -[NSView
> _postFrameChangeNotification] + 259
> 19 com.apple.AppKit 0x00007fff8cb728f3 -[NSView
> setFrameSize:] + 1352
> 20 com.apple.AppKit 0x00007fff8cc47c86
> -[NSTextView(NSPrivate) _setFrameSize:forceScroll:] + 1367
> 21 com.apple.AppKit 0x00007fff8cc13d33
> -[NSTextContainer setContainerSize:] + 193
> 22 com.apple.AppKit 0x00007fff8cc43ac9
> -[NSTextContainer(NSPrivate) _resizeAccordingToTextView:] + 289
> 23 com.apple.CoreFoundation 0x00007fff8846547a
> _CFXNotificationPost + 2554
> 24 com.apple.Foundation 0x00007fff85251846
> -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
> 25 com.apple.AppKit 0x00007fff8cb8821e -[NSView
> _postFrameChangeNotification] + 259
> 26 com.apple.AppKit 0x00007fff8cb728f3 -[NSView
> setFrameSize:] + 1352
> 27 com.apple.AppKit 0x00007fff8cc47c86
> -[NSTextView(NSPrivate) _setFrameSize:forceScroll:] + 1367
> 28 com.apple.AppKit 0x00007fff8cc13d33
> -[NSTextContainer setContainerSize:] + 193
> 29 com.apple.AppKit 0x00007fff8cc43ac9
> -[NSTextContainer(NSPrivate) _resizeAccordingToTextView:] + 289
I just responded to an identical post in the dev forums, which I assume was yours <https://devforums.apple.com/message/783296#783296>:
See the last paragraph from Text System Storage Layer Overview: Tracking the Size of a Text View:
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TextStorageLayer/Tasks/TrackingSize.html
> Note that a text view can be resized based on its text container, and a text container can resize itself based on its text view. If you set both objects up to resize automatically in the same dimension, your application can get trapped in an infinite loop. When text is added to the text container, the text view is resized to fit the area actually used for text; this causes the text container to resize itself and relay its text, which causes the text view to resize itself again, and so on ad infinitum. Each type of size tracking has its proper uses; be sure to use only one for either dimension.
Cheers,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden