object_retain and box objects

    Mar 17 2011 | 10:19 pm
    I am working at a family of objects composed by a server and several clients. I need the server object not to be freed until there is one client in existence, and I use reference counting for this.
    I have made some tests in which I remove from the patcher an object whose reference count is > 1, and everything seems to work well: the box disappears, the patcher doesn't go crazy and the object still continues to exist until all its references are released.
    But I wish to be sure that retaining a box object has no bad side effects I didn't notice. Of course I can think of an alternative with a nobox object being retained, and the box "server" just being an interface to it: but this would make the design of the whole system more complicated, and if it's not necessary I'd rather not.
    Thanks for your advice! aa

    • Mar 21 2011 | 10:46 pm
    • Mar 22 2011 | 12:45 pm
      Hi Vanille. Actually, the sheep/shepherd example addresses a slightly different situation. As you say, I "want the object to survive after been freed by user while retainer object still alive"... thanks anyway! aa