• 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: NSTextField not updated during large process
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField not updated during large process


  • Subject: Re: NSTextField not updated during large process
  • From: Koen van der Drift <email@hidden>
  • Date: Mon, 01 Oct 2012 17:39:38 -0400

On Oct 1, 2012, at 8:59 AM, Koen van der Drift <email@hidden> wrote:

> Ok, I decided to use NSOperation(Queue) as it is generally recommended
> over performSelectorXXX to be a more modern API, and have been reading
> a bit about it.  In Hillegass' Cocoa book, he uses processQueue
> addOperationWithBlock, in other examples on the webs, people make
> subclasses of NSOperation to put their tasks in. What's the difference
> between these two appraches (if any)?

Playing around with NSOperationQueue, and I implemented it as follows. I use this method to do some calculations, and store the results in a table.

- (void)doMyTask
{
    [self cleanUp];  // clear the NSTableView

    NSOperationQueue    *myQueue = [[NSOperationQueue alloc] init];

    [myQueue addOperationWithBlock:^(void)
    {
        [self parseData];	// calculate the new data and update the model
	}];

 // now tell everyone we're done
    [self finishedTask];		// update the NSTableView and the UI
}

This works, and is faster than before, but if I run this several times in a row, at one point I get a crash, somewhere in the parseData routine.  It could happen after ten times, or even after one time. But always at the same point:

                    [self willChangeValueForKey:@"myArray"];
                    [self.myArray addObject: newObject];
                    [self didChangeValueForKey:@"myArray"];

This is called during the parse, when I update the myArray property as a result of the parsing.

Any idea what could be going on?

- Koen.


_______________________________________________

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

  • Follow-Ups:
    • Re: NSTextField not updated during large process
      • From: Mike Abdullah <email@hidden>
    • Re: NSTextField not updated during large process
      • From: Koen van der Drift <email@hidden>
References: 
 >Re: NSTextField not updated during large process (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Re: The joy of unexpected SIGABRTs
  • Next by Date: Re: FS item in trash
  • Previous by thread: Re: NSTextField not updated during large process
  • Next by thread: Re: NSTextField not updated during large process
  • Index(es):
    • Date
    • Thread