• 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: newbie EXC_BAD_ACCESS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: newbie EXC_BAD_ACCESS


  • Subject: Re: newbie EXC_BAD_ACCESS
  • From: mmalcolm crawford <email@hidden>
  • Date: Mon, 21 Mar 2005 00:23:06 -0800


On Mar 21, 2005, at 12:12 AM, Daniel Child wrote:

Once sigdev error was solved, I was having troubles because the knownStrokes array was getting the last copy of sd created placed in every single slot of the array.

Per my first reply:

"From your original listing, it looks like you're creating a single instance of StrokeDescription and simply updating its type and description on each iteration through the loop? Or does [self addStrokeDesc: sd] add a copy of the StrokeDescription? What is the implementation of addStrokeDesc:?"

(Cutting your original code down to the relevant pieces:)

// ...
  StrokeDescription *sd = [[StrokeDescription alloc] init];
// ...

  for (i = 0; i < 44; i++)
  {
// ...
      [self addStrokeDesc: sd];
    } // end inner for
  } // end outer for
  [sd release];
}


You only created a single instance of StrokeDescription (sd), updated its variables on each iteration, and added it to self. Assuming that addStrokeDesc: didn't copy the StrokeDescription, then "the knownStrokes array was" *not* :getting the last copy of sd created placed in every single slot of the array" -- it was getting the same object (the only one you created) at each slot in the array...


mmalc

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: newbie EXC_BAD_ACCESS (From: Daniel Child <email@hidden>)

  • Prev by Date: Re: newbie EXC_BAD_ACCESS
  • Next by Date: Re: Creating a large Cocoa project - tutorials? - OT: underscore use
  • Previous by thread: Re: newbie EXC_BAD_ACCESS
  • Next by thread: Re: newbie EXC_BAD_ACCESS
  • Index(es):
    • Date
    • Thread