checking for G_SIGNAL_TYPE_STATIC_SCOPE from closures



I was looking at how to handle signals with STATIC_SCOPE arguments in
python correctly.

Currently I have routines that convert GValues to python objects and vice
versa.  The GValue -> PyObject conversion routine copies boxed types by
default (because I don't want them to disapear from beneath the wrapper),
but this breaks signals with STATIC_SCOPE args where the handler is
supposed to modify the boxed type (size_request, some GtkTextIter signals,
selection handling code, etc).  In this case, it is probably better to
risk the segfault (from the object going away) in order to have a working
system.

I was wondering what the best way to check for this flag is from within
the closure.  I worked out one way to do it, but don't know if it is the
best way:

- cast the invocation_hint argument to the closure's marshal function to a
  GSignalInvocationHint structure to get the signal_id
- use g_signal_query on the signal id
- check for the G_SIGNAL_TYPE_STATIC_SCOPE on each of the members of the
  query->param_types array.

Is this the best way to do this?  Would the extra g_signal_query() calls
slow things down much?

James.

-- 
Email: james daa com au
WWW:   http://www.daa.com.au/~james/






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