• 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
Appending string to NSTextView crashing app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Appending string to NSTextView crashing app


  • Subject: Appending string to NSTextView crashing app
  • From: Evan Moseman <email@hidden>
  • Date: Tue, 24 Apr 2007 22:29:38 -0400

I'm hoping somebody can help me with this, I'm trying to append text to an NSTextView using this function:

- (void)appendString:(NSString *)string toView:(NSTextView *)view
{
if (string == nil) { return; }
[view setEditable:YES];
NSString *subString = [[NSString alloc] initWithFormat:@"%@\n", string];
NSAttributedString *stringToAppend =
[[NSAttributedString alloc] initWithString:subString];
[[view textStorage] appendAttributedString:stringToAppend];
[view setEditable:NO];
}



But, after about 10 strings, the whole app crashes with a seg fault. I can print the strings using NSLog and it never crashes. Is there something wrong with the above code? Should I try using bindings?


Any help is greatly appreciated!

Thanks!

--
Evan _______________________________________________


Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: Appending string to NSTextView crashing app
      • From: Ryan Stevens <email@hidden>
  • Prev by Date: determining minimum bounds to view all content of a view
  • Next by Date: Re: Quartz flash screen updates
  • Previous by thread: determining minimum bounds to view all content of a view
  • Next by thread: Re: Appending string to NSTextView crashing app
  • Index(es):
    • Date
    • Thread