Trying to understand NSOperation

2011-02-27 Thread Banlu Kemiyatorn
Hi, please help me trying to understand the code below which try to demonstrate op queuing behaviors. Questions are in the comments. #include #import @interface MyOp : NSOperation { @public NSString *name; int sec; } @end static MyOp *a; static MyOp *b; static MyOp *c; @implem

Re: Trying to understand NSOperation

2011-02-27 Thread Banlu Kemiyatorn
- (void) addDependency: (NSOperation *)op { if (NO == [op isKindOfClass: [self class]]) { ... Should [self class] be [NSOperation class] ? but why bother checking at all? ___ Gnustep-dev mailing list Gnustep-dev@gnu.org http://lists.gnu.org/mailma

Re: Trying to understand NSOperation

2011-02-27 Thread Banlu Kemiyatorn
- (void) observeValueForKeyPath: (NSString *)keyPath ... while ((op = [en nextObject]) != nil) { if (NO == [op isReady]) <-- should this be isFinished ? break; } ___ Gnustep-dev mailing list Gnustep-dev@gnu.org htt

Re: Trying to understand NSOperation

2011-03-04 Thread Banlu Kemiyatorn
When NSOperation finish in -_finish it didChangeValueForKey:@"isFinished" (525) in NSKeyValueObserving.m:1739 it [pathInfo notifyForKey: aKey ofInstance: [info instance] prior: NO]; which make it be removed from the op queue and deallocated at NSOperation.m:902 and crash at NSKeyValueObserving.m:17

Re: Trying to understand NSOperation

2011-03-04 Thread Richard Frith-Macdonald
On 4 Mar 2011, at 22:20, Banlu Kemiyatorn wrote: > When NSOperation finish in -_finish > it didChangeValueForKey:@"isFinished" (525) > in NSKeyValueObserving.m:1739 it [pathInfo notifyForKey: aKey > ofInstance: [info instance] prior: NO]; > which make it be removed from the op queue and deallocat