Re: [sigc] is it possible to disconnect without storing `sigc::connection'?



On Wed, 2006-10-11 at 21:19 +0300, Paul Pogonyshev wrote:
> Right, I know this.  I wondered if I could not store connection objects,
> as I know what handlers _this_ object has connected to a signal.  I wished
> to remove them just by (object + function) pair.
> 
> Here is situation I have.   Object A has a pointer to some model, B.  It
> connects to some signals in B to listen for some events.  Now, if the
> model changes to C, A has to disconnect its handlers from B and connect
> them to C instead.  I wondered if I could do that without storing
> connections, as that seems excessive.

the not very clearly named sigc::trackable::notify_callbacks() gets
close to this, but is intended to be called from the destructor of a
trackable or derived type. it will cause all connections to the signals
of the object it is called for to be dropped. sigc++ keeps track of the
connections, you see. but note: i do mean *all* connections. you have no
control over which ones.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]