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

Re: Appending string to NSTextView crashing app


  • Subject: Re: Appending string to NSTextView crashing app
  • From: PGM <email@hidden>
  • Date: Wed, 25 Apr 2007 23:27:36 -0400


On 25-Apr-07, at 22:42 PM, Evan Moseman wrote:

A button is linked to:

- (IBAction)startAppButton:(id)sender
{
  [self appendString:@"Starting notification event capture..."
              toView:applicationTextView];
  [[NSNotificationCenter defaultCenter]
    addObserver:self
    selector:@selector(appNotificationObserver:)
    name:nil object:nil];
}

The selector is this function:

- (void)appNotificationObserver:(NSNotification *)note
{
  NSLog(@"app note: %@", [note name]);
  [self appendString:[note name] toView:applicationTextView];
}

I do not know if this is causing the crash, but it seems to me that something akward should be happening here. You are registering your object to receive any notification sent by any object. You then place this notification in an NSTextView. This causes a NSTextDidChangeNotification to be sent, which in return is placed inside your NSTextView. This causes an infinite loop of notifications. If you only use NSLog, you don't have this problem as no notification is sent upon logging.


Cheers, Patrick
_______________________________________________

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: Evan Moseman <email@hidden>
References: 
 >Appending string to NSTextView crashing app (From: Evan Moseman <email@hidden>)
 >Re: Appending string to NSTextView crashing app (From: Ryan Stevens <email@hidden>)
 >Re: Appending string to NSTextView crashing app (From: Evan Moseman <email@hidden>)
 >Re: Appending string to NSTextView crashing app (From: PGM <email@hidden>)
 >Re: Appending string to NSTextView crashing app (From: Evan Moseman <email@hidden>)

  • Prev by Date: Re: Appending string to NSTextView crashing app
  • Next by Date: CFPropertyListWriteToStream and NSDictionary
  • Previous by thread: Re: Appending string to NSTextView crashing app
  • Next by thread: Re: Appending string to NSTextView crashing app
  • Index(es):
    • Date
    • Thread