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

Re: CalendarMonthImageGenerator


  • Subject: Re: CalendarMonthImageGenerator
  • From: Ali Ozer <email@hidden>
  • Date: Fri, 20 Oct 2006 11:46:36 -0700

I also am not sure how to manage NSColor memory for the calendar month
attributes.  When I release them, my app crashes.

Because you didn't retain them in the first place:


backgroundColor = [NSColor colorWithCalibratedRed:red green:green blue:blue alpha:alpha];

retains and releases almost always need to be paired (and sometimes instead of "retain" you might get a reference count via a "copy," "alloc," or "new" method).


Similarly in your monthImage method, you return an allocated object, while you should really return an object without a reference count --- so autorelease your return value, or name the method something like newMonthImage to make it clear to callers that they are getting a retained object.

Ali

_______________________________________________
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: 
 >CalendarMonthImageGenerator (From: "Jordan Evans" <email@hidden>)

  • Prev by Date: Re: Over-released Paragraph Style - Driving Me NUTS!
  • Next by Date: Overriding default width of a NSAlert?
  • Previous by thread: CalendarMonthImageGenerator
  • Next by thread: Overriding default width of a NSAlert?
  • Index(es):
    • Date
    • Thread