if(![object FREED]){

Discussion in 'iPhone/iPad Programming' started by cwolves, Apr 21, 2009.

  1. macrumors regular

    Joined:
    Oct 11, 2007
    #1
    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. macrumors 6502a

    Joined:
    Oct 29, 2006
    Location:
    Virginia
    #2
    Personally, I would say that is a bug. I would rethink your design on this.
     
  3. macrumors 6502

    Joined:
    Apr 24, 2003
    #3
    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