• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView


  • Subject: Re: NSTextView
  • From: Ken Ferry <email@hidden>
  • Date: Fri, 24 Sep 2010 02:23:14 -0700

Can you sample the app while it's hung and produce backtraces?

I'm curious if perhaps you are violating Cocoa threading contracts.  Are you
aware that for the most part, the UI portions of Cocoa may not be used from
background threads?

Just adding text quickly should not be causing a hang.

-Ken

On Wed, Sep 22, 2010 at 2:56 PM, albert jordan <email@hidden> wrote:

>
> Thanks Kyle for the suggestion,
>
>
> I still get the app to hang.  if I bypass writing to the text view things
> work fine, so I'm certain it's this operation that hangs the application.
>  Based on everyone's feedback, below is what I've come up with so far.
>  "adbLog" is the culprit TextView.    The app works initially, and I always
> get the shouldChangeTextInRange method to return YES.
>
> I'm going to try buffering the lines, and update the view in a batch
> mode...  running out of ideas...
>
>
> Thanks again for all that have helped so far.
>
> Regards,
>
> Albert
>
>
>
>
>
>        BOOL flag = [adbLog shouldChangeTextInRange:NSMakeRange(NSNotFound,
> 0) replacementString:nil];
>
>        if ( flag == YES ) {
>
>                NSLog(@"DeviceWindowController: permission to write to
> buffer\n");
>
>                NSMutableAttributedString *attstr =
> [[[NSMutableAttributedString alloc] initWithString:line] autorelease];
>                [[adbLog textStorage] beginEditing];
>                [[adbLog textStorage] appendAttributedString:attstr];
>                [[adbLog textStorage] endEditing];
>                [adbLog didChangeText];
>                //[adbLog display] ;
>        } else {
>                NSLog(@"Couldn't get permission to change the text\n");
>         }
>
> On Sep 22, 2010, at 11:04 AM, Kyle Sluder wrote:
>
> > On Wed, Sep 22, 2010 at 10:43 AM, albert jordan <email@hidden>
> wrote:
> >> Hi Martin,
> >>
> >> THanks so much for the suggestion.
> >>
> >> The approach improves the situation, but unfortunately does not resolve
> it.  But understand now that this is the issue, I'm going to see if there
> will be another work around.
> >
> > If you want to edit a text view's text storage, you must call
> > -shouldChangeTextInRange:replacementString: on the text view before
> > mutating the text storage, and then call -didChangeText afterwards.
> >
> > --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
>
_______________________________________________

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

References: 
 >NSTextView (From: albert jordan <email@hidden>)
 >Re: NSTextView (From: Martin Hewitson <email@hidden>)
 >Re: NSTextView (From: albert jordan <email@hidden>)
 >Re: NSTextView (From: Kyle Sluder <email@hidden>)
 >Re: NSTextView (From: albert jordan <email@hidden>)

  • Prev by Date: Re: Cocoa Text System - Temporarily Disabling Layout
  • Next by Date: Re: NSTimer memory management
  • Previous by thread: Re: NSTextView
  • Next by thread: Instance an from an NSString Class name
  • Index(es):
    • Date
    • Thread