Are you sure you're retaining your particles dictionary so its not being 
autoreleased? I can't see where you've created it so cannot be certain. This 
sort of mistake often causes these sorts of crashes (works initially, doesn't 
shortly after).

An easier and probably safer approach would be to just set your outputParticles 
property directly to a new dictionary that you create each time, rather than 
trying to maintain one mutable object over time, and then having to retain it, 
etc.

And finally, to answer your source comment, no they're not the same - the first 
one changes the contents of your self.outputParticles dictionary to match those 
of particles. The second one assigns (depending on your @property declaration) 
the object directly to the property, which is what you're wanting.

Try this:

NSMutableDictionary* particles = [NSMutableDictionary dictionary];

for(int i=0;i<self.inputAmount;i++){
        NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
                                                                        
[NSString stringWithFormat:@"%i", rand()], @"x",
                                                                        
[NSString stringWithFormat:@"%i", rand()], @"y",
                                                                        
[NSString stringWithFormat:@"%i", rand()], @"z",
                                                                        
[NSString stringWithFormat:@"%i", rand()], @"random value",
                                                                        nil];
        [particles setObject:dictionary forKey:[NSString 
stringWithFormat:@"%i",i]];
}
self.outputParticles = particles;




Best,

A.


On 28 Sep 2010, at 10:57, Stefan Kainbacher, NEON GOLDEN wrote:

> 
> hello together, 
> 
> i would like to build a plugin that has one input (number) and an output 
> (structure).
> 
> if i change the the number on the input it should give me a a dictionary or 
> array with n=inputNumber elements. it works the first time and hands out the 
> structure in qc, but when i change the input qc crashes. whats wrong? what do 
> i miss?
> 
> 
> - (BOOL) execute:(id<QCPlugInContext>)context atTime:(NSTimeInterval)time 
> withArguments:(NSDictionary*)arguments
> {
>       
>       NSLog(@"Amount: %i", self.inputAmount);
>       //[particles removeAllObjects];
>       
>       for(int i=0;i<self.inputAmount;i++){
>       
>               NSDictionary *dictionary = [NSDictionary 
> dictionaryWithObjectsAndKeys:
>                                                                       
> [NSString stringWithFormat:@"%i", rand()], @"x",
>                                                                       
> [NSString stringWithFormat:@"%i", rand()], @"y",
>                                                                       
> [NSString stringWithFormat:@"%i", rand()], @"z",
>                                                                       
> [NSString stringWithFormat:@"%i", rand()], @"random value",
>                                                                       nil];
>               [particles setObject:dictionary forKey:[NSString 
> stringWithFormat:@"%i",i]];
>       }
>       
>       [self.outputParticles setDictionary:particles];  // BTW: IS THIS THE 
> SAME? self.outputParticles = particles;  
>       
>       return YES;
> }
> 
> 
> full source download (2.5 mb) available here:
> 
> http://dl.dropbox.com/u/950822/Quartz%20Composer/NG%20ParticleSystem%2001.zip
> 
> 
> cheers, stefan

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to