• 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: Today is messed up
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Today is messed up


  • Subject: Re: Today is messed up
  • From: Shawn Erickson <email@hidden>
  • Date: Sun, 10 Aug 2003 08:35:56 -0700

On Sunday, August 10, 2003, at 01:58 AM, Wesley Penner wrote:

Hi,

I'm having trouble with this bit of code. Can anyone explain why?

- (int)setupDates {
int way;
NSCalendarDate *today = [NSCalendarDate calendarDate];
[today years:NULL months:NULL days:&way hours:NULL minutes:NULL
seconds:NULL sinceDate:startDate]; // <-- debugger stops here
way++;
....

All I can assume from the code shown that your problem is with startDate not being a valid object when setupDates is called. The most obvious cause is a missing retain... how is startDate created and stored?

[today release]; // <-- is this really necessary? Added when the
problems started to try and circumvent them
}

No you should not release "today" you didn't directly allocate or copy it, it was created for by NSCalendarDate in response to the "calenderDate" message you sent it. Since NSCalendarDate allocated it is responsible for making sure it gets released so it sent an autorelease message to it before returning it to you.

The first time through it performs as expected, assigning way to be the
number of days since startDate (set elsewhere). However, when I reset
startDate and call this a second time, it ends with "EXC_BAD_ACCESS".
(By the by, what does that mean anyway? I found no reference in the
documentation.)

Google is your friend...

http://www.omnigroup.com/mailman/archive/macosx-dev/2002-February/ 023694.html

The debugger shows that within the variable today there is a problem:
*((((((today)->isa)->cache)->buckets)[0]->method_types) [-[Controller
setupDates]0-Thread-1] :: out of scope

I have no idea what it means, so it sounds very impressive. How can I
fix this?

It most likely is a result of the debugger not having access to the stack frame that contains needed information and/or a stack allocated variable has simple fallen out of scope (in the coding sense). This is likely just a normal result of the location that you have dropped into the debugger.

-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Today is messed up (From: Wesley Penner <email@hidden>)

  • Prev by Date: wrapper for zlib
  • Next by Date: Re: Scrolling Thumbnails (Like Preview)
  • Previous by thread: Re: Today is messed up
  • Next by thread: Re: Today is messed up
  • Index(es):
    • Date
    • Thread