Re: NSRunStorage and _NSBlockNumberForIndex exceptions...
Re: NSRunStorage and _NSBlockNumberForIndex exceptions...
- Subject: Re: NSRunStorage and _NSBlockNumberForIndex exceptions...
- From: Keith Blount <email@hidden>
- Date: Sun, 11 Nov 2007 15:13:58 -0800 (PST)
After more testing, it looks as though this is a bug in the text system and not specifically in my text storage code. There seems to be something in this particular piece of text (brought in from Word) that is causing problems for the text system. To test, I created a very simple text storage based on Ali Ozer's code here:
http://www.cocoabuilder.com/archive/message/cocoa/2002/2/5/14848
I put it into a text view, loaded the text that was causing problems, and straight away got the same error:
2007-11-11 23:03:28.244 TextStorageCrashTest[41297:813] Exception raised while text storage 0x1bc840 was responding to font set changed notification: *** NSRunStorage, _NSBlockNumberForIndex(): index (16289) beyond array bounds (16289)
2007-11-11 23:03:28.265 TextStorageCrashTest[41297:813] Exception raised during background layout: *** NSRunStorage, _NSBlockNumberForIndex(): index (16289) beyond array bounds (16289)
And so on. Then I started replacing random characters in the problem text in TextEdit ready to send off for a bug report (to garble the content), and ran into exactly the same error on the console for TextEdit.
For anyone interested, the test project that shows this bug can be downloaded here:
http://www.literatureandlatte.com/dlbeta/TextStorageCrash.zip
(Just open the app and then, after the window appears, click New to open a new window loaded from the same file, and watch the errors appear on the console.)
Off to file a bug report right now...
All the best,
Keith
--- ORIGINAL MESSAGE ---
Hi,
In my program I have been getting the following error message in the debugger console from time to time:
2007-11-11 21:10:11.269 AppName[39092:813] Exception raised while text storage 0x126ab1d0 was responding to font set changed notification: *** NSRunStorage, _NSBlockNumberForIndex(): index (16572) beyond array bounds (16571)
2007-11-11 21:10:11.273 AppName[39092:813] Exception raised during background layout: *** NSRunStorage, _NSBlockNumberForIndex(): index (16572) beyond array bounds (16571)
My app holds a number of documents and you can browse through them (basically like an outliner). It uses an NSTextStorage subclass to display these documents, which does nothing special other than provide a running word count. The above exceptions occur apparently randomly, but are clearly associated with a particular document in the app: the index and bounds numbers match with a text that has an NSFormFeedCharacter as the first character, though I have tried inserting this character at the beginning of other texts to see if loading them throws a similar exception with little luck so far. The exception usually occurs when browsing through documents in a different window, or when the window containing this document either loses or gains focus.
It looks as though it could be my text storage subclass, I suppose, which can be downloaded here:
http://www.literatureandlatte.com/freestuff/KBWordCountingTextStorage.zip
If anyone has any ideas about what might be causing this, I would be very grateful (this is running on Leopard, btw).
Thanks and all the best,
Keith
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
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