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



Paul Pogonyshev wrote:
> Hi,
>
> In C-level GTK+ there is a function named g_signal_handlers_disconnect_matched(). > It can be used to disconnect, for instance, particular handlers (i.e. with > matching function) of an object. Is something similar possible with libsigc++
> or do I have to store `sigc::connection' objects around?

Hi Paul,

When you connect to a signal you get an iterator back from signal::connect(). You could use this iterator or copy the slot the iterator points to and then call it->disconnect() or slotcopy.disconnect();

Note however that the iterator is only valid as long as the signal's slot list is valid.
Connections have a trackable mechanism and are therefore safer.


--
Klaus Triendl



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