object_retain and box objects

Mar 17, 2011 at 10:19pm

object_retain and box objects

Hi.

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

#55627
Mar 21, 2011 at 10:46pm

bang…

#200100
Mar 22, 2011 at 7:33am

Hello andrea,

have you seen the “shepherd/sheep” example in the last SDK ?

I founded it nice for this kind of stuff,
even if i’m not sure it is what you want to do,
(as i’m not sure to understand really what you want to do ;
you want the object to survive after been freed by user while retainer object still alive ?)

#200101
Mar 22, 2011 at 12:45pm

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

#200102

You must be logged in to reply to this topic.