>> On 01/09/2011, at 8:52 PM, jonat...@mugginsoft.com wrote:
>> 
>> Is it possible that the user is editing the textview when this code is 
>> triggered?
>> From the looks of the trace you react directly to the mouseDown event in 
>> another view which might not give NSTextView opportunity to conclude its 
>> edit.

I think you're confused. The beginEditing/endEditing methods are not called on 
NSTextStorage when the user begins and edits an edit via NSTextView. The 
NSTextStorage editing methods are merely to group related changes made to the 
model for optimization purposes. Those methods must be balanced and closed 
immediately within a single method's scope; the NSTextView should never leave a 
-[NSTextStorage beginEditing] call open just because the text view is still 
first responder.


> On 2011.09.01, at 5:31 AM, Gideon King wrote:

> 

> Hmmm, I see that there is a place in my code where they can be editing the 
> text view, and then they mouse down in its containing view, and that triggers 
> an event to be posted through NSApp at the end of the event queue and an 
> autorelease being sent to the enclosing view which would eventually result in 
> the text view being removed, while that event could trigger a 
> glyphRangeForTextContainer call. I guess that might leave things open to the 
> possibility of something still being edited when I am working with the text. 

I don't see why removing the NSTextView should cause it to begin editing on the 
text storage. I suppose it would if there was marked input text that NSTextView 
needed to confirm or abandon, but if the NSTextView is removed completely it 
should have closed out all its editing.

Maybe there's some unexpected interactions during teardown and NSTextView is 
getting confused. Can you explicitly end editing and remove the NSTextView 
yourself when your custom view is removed? You might also log/trace all the 
calls to beginEditing/endEditing and see where the unbalanced call originates 
from.

~Martin

_______________________________________________

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 arch...@mail-archive.com

Reply via email to