Re: order of GSignal callbacks



On Fri, 5 Oct 2001 vishnu pobox com wrote:

> On Fri, Oct 05, 2001 at 06:21:13PM -0700, vishnu pobox com wrote:
> > i'm already using all of the signal execution stages (before, during,
> > after) for ordering.  i'm asking about checking ordering within a stage.
> > Something like:
> > 
> > g_assert (g_signal_handler_order_by_func
> >                (instance, "set-span", 0 /*detail*/, cb1, cb2) < 0);
> > 
> > Could i write such a function using the current API?
> 
> Is it crazy to rely on the empirical callback order?
> 
> Separately, i think it would be worthwhile to add a method
> for this idiom:
> 
>   g_signal_handlers_disconnect_matched
> 	(instance, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, object);
> 
> Perhaps:
> 
>   g_signal_handlers_disconnect_object (instance, object);
> 
> ?

nope, matching signal handlers solely on their data is not
recommended. the reason being that clashes are likely to
emerge and can produce unpredictable results, consider:

libgnome:
  signal_connect ("mysig", gnomefunc, GUINT_TO_POINTER (g_quark_from_string ("blub")));
libgtk:
  signal_connect ("mysig", gtkfunc, GUINT_TO_POINTER (GTK_ANCHOR_WEST));
application:
  signal_connect ("mysig", appfunc, GUINT_TO_POINTER (7));
  [...]
  signal_disconnect_by_data ("mysig", GUINT_TO_POINTER (7));

the disconnect call will remove appfunc from "mysig", but also gtkfunc
because GTK_ANCHOR_WEST happens to be ==7. gnomefunc might also be
disconnected, depending on whether the quark system handed out 7 as
the quark id for "blub".

> 
> -- 
> Victory to the Divine Mother!!
>   http://sahajayoga.org
> 

---
ciaoTJ





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