Re: Crasher due to unsafe block implementation in -[NSTextView checkTextInRange:types:options:]?
Re: Crasher due to unsafe block implementation in -[NSTextView checkTextInRange:types:options:]?
- Subject: Re: Crasher due to unsafe block implementation in -[NSTextView checkTextInRange:types:options:]?
- From: Aki Inoue <email@hidden>
- Date: Wed, 3 Aug 2011 15:32:13 -0700
Kyle,
It appears you're right.
Another approach is to use multiple field editor objects so that you keep the first editor content unmodified.
Aki
On 2011/08/02, at 18:37, Kyle Sluder wrote:
> On Tue, Aug 2, 2011 at 6:09 PM, Aki Inoue <email@hidden> wrote:
>> Hi Tom,
>>
>> Definitely write a Radar.
>
> I just got this distilled down into an extremely simple demo project.
> rdar://problem/9886471
>
> The demo project is here for any interested third parties: http://db.tt/7hA7i8m
>
>> One thing you could try is overriding both -checkTextInRange:types:options: & -handleTextCheckingResults:forRange:types:options:orthography:wordCount: for your field editor.
>>
>> You can have some kind of the field editor session ID.
>>
>> Every time a new field editor starts, you increment the ID. Then, inside your -checkTextInRange:, you can pass the session ID via the options dict to super.
>>
>> Inside -handleTextCheckingResult:, validate the session ID inside the options dict against the current ID. Forward the message to super only when they match.
>
> The problem isn't within -handleTextCheckingResult:…, but rather
> within the block that -handleTextCheckingResult:… passes to
> -[NSSpellChecker showCorrectionIndicatorOfType:…]. That block is
> assuming that whenever it gets executed, the text view will still be
> attached to the same field editor it was attached to when it was
> enqueued on the main thread.
>
> We would need to inject this session ID check into the
> completionHandler. The only way I can think of accomplishing that
> would be to swizzle -showCorrectionIndicatorOfType:….
>
> --Kyle Sluder
_______________________________________________
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