title: NSMutableArray: How do I fix this 'EXC_BAD_ACCESS' code?
body: <p>I am making an OpenGL Application but I get an EXC_BAD_ACCESS message.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>//(draw function only, ask if you need more)
  //objects: array of triangles/quads
  //Triangle/Quad3D: should be obvious, I like OOP
  //PS this is in a 'Composite Object' class
  - (void)draw {
      //NSLog(@"%@",objects);
      NSMutableArray *quad, *tri;
      quad =  [NSMutableArray arrayWithCapacity:0];
      tri =   [NSMutableArray arrayWithCapacity:0];
      NSEnumerator *e = [objects objectEnumerator];
      id object;
      while (object = [e nextObject]) {
          if ([object isKindOfClass:[Triangle3D class]]) {
              [tri addObject:(Triangle3D *)object];
          } else if ([object isKindOfClass:[Quad3D class]]) {
              [quad addObject:(Quad3D *)object];
          }
      }
      NSLog(@"%d",[tri count]);
      NSLog(@"%d",[quad count]);
      [quad release];
      [tri release];
      [e release];
  }
  </code></pre>