Re: Question about signals in GObject



On Sun, 2007-07-29 at 12:45 +0200, Tomasz Jankowski wrote:

I need to know, when exactly callback function is called. Is it
called during  'g_signal_emit ()' or it's added to GMainLoop or something?

no: you don't need a main loop to emit signals.

My code looks like this, please tell me if it may occur any memory
allocation errors:

A = g_alloca ();
g_signal_emit(..., A and other args);
g_free (A);

I guess A is not a type known to GType, or you are passing it as a
G_TYPE_POINTER. the code above should always work.

if one of the signal handlers will free any of the passed arguments,
though, then you'll have a double free; if you are writing a library
(and you don't control all the signal handlers), then you should protect
the G_TYPE_POINTER arguments using const.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net




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