if(![object FREED]){

Discussion in 'iOS Programming' started by cwolves, Apr 21, 2009.

  1. cwolves macrumors regular

    Oct 11, 2007
    I have an object that is released in the middle of doing something. Specifically, it's an animation. When it changes to a frame, an event gets called via an NSNotification, and the subscriber sometimes releases the object.

    The issue I'm running into is that after the object is released, control passes back to the object. It then calls [super render] which renders another frame of the animation.

    If I check self at any point after the release, I get a type of "FREED(ID) *", with all the data still intact.

    So my question is, is there a "correct" way of saying "only call [super render] if I still exist"?

    btw "if(self){" doesn't work. :D
  2. eddietr macrumors 6502a

    Oct 29, 2006
    Personally, I would say that is a bug. I would rethink your design on this.
  3. neoserver macrumors 6502

    Apr 24, 2003
    I don't believe there is a method that you can send to a released object (which based on what i understand of your problem, would not exist anymore) to see if it exists. Either the object exists and it works, or it doesn't and you get an exec_bad_access. like eddietr, I'd take a look at your design and fix it up that way.

Share This Page