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: Oleg Krupnov <email@hidden>
- Date: Fri, 08 Feb 2013 20:45:11 +0200
Hi Ken,
Thanks! This information sounds relevant, but I'm still puzzled. All I
do is just use a NSTextView on a window. The text view is resizable by
width and height, i.e. the text is wrapped when I change the view's
width, and scroll bar appears when I change its height. All pretty
standard. I do not delve under the hood, do not assemble my own text
editor from the components of the text system. I don't use text
container directly in my code.
Besides, even if this was the reason, why does it not manifest in
normal use cases, but only in some very rare and obscure
circumstances? Namely, when MacBook wakes from sleep mode? There were
no reports even from iMacs or MacMinis, only MacBooks. Mostly it
happens on 10.8.2, but one report was assumably from 10.7.5.
I appreciate your help very much! I've found nothing in the Internet
on this, and the bug is pretty critical.
On Fri, Feb 8, 2013 at 5:11 PM, Ken Thomases <email@hidden> wrote:
> 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