Re: [sigc] libsigc problems



On Tue, 2005-11-29 at 22:20 +0100, luca wrote:

>     void emitSignal ()
>     {
>         signal.*emit* ();
>     }
> 
>     void on (X* x)
>     {
>         *delete* *this*;
>     }
> };
> 
   [ ... ]

> since i destroyed the object i am emitting the signal from (and also the 
> slot will be destroyed indeed). Anyone has a better design to avoid this 
> problem?

in a Gtk/Glib context, i have:


template<typename T> gint idle_delete (T *obj) { delete obj; return
FALSE; }
template<typename T> void delete_when_idle (T *obj) {
	Glib::signal_idle().connect (sigc::bind (sigc::ptr_fun
(idle_delete<T>), obj));
}

you would need some equivalent of Glib::signal_idle()

--p





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