• 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
[OT] Retain count riddle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OT] Retain count riddle


  • Subject: [OT] Retain count riddle
  • From: "Sailesh Agrawal" <email@hidden>
  • Date: Tue, 30 Mar 2004 14:49:28 -0500

So I had this bug the other day that I thought would make an interesting
riddle.

The code looked like this:

#define SAFE_SET(old, new) [new retain]; [old release]; old = new;

...

- (void) foo : (NSString*)path {
SAFE_SET(m_Path, [path lastPathComponent]);
}

Now the problem was any time I accessed m_Path my app would crash. This
isn't cocoa specific, I'm just dumb for using macros where I should have
been using a function. Can anyone guess what the problem is ?

good luck !
Sailesh
_______________________________________________
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.


  • Follow-Ups:
    • Re: [OT] Retain count riddle
      • From: Chris Hanson <email@hidden>
    • Re: [OT] Retain count riddle
      • From: Steve Stockman <email@hidden>
    • RE: [OT] Retain count riddle
      • From: "Jonathan E. Jackel" <email@hidden>
    • Re: [OT] Retain count riddle
      • From: Andreas Mayer <email@hidden>
    • Re: [OT] Retain count riddle
      • From: Shawn Erickson <email@hidden>
    • Re: [OT] Retain count riddle
      • From: Stéphane Sudre <email@hidden>
  • Prev by Date: Re: Distributed Objects pitfalls and strategies
  • Next by Date: NSOpenGLView newbie question.
  • Previous by thread: [SOLVED] Re: NSHangOnUncaughtException does not work ?
  • Next by thread: Re: [OT] Retain count riddle
  • Index(es):
    • Date
    • Thread