(gtk2) return value and g_signal_emit() with no handler



I have a signal in my widget which currently have no handlers at all. This 
signal returns a gboolean. When I call g_signal_emit() I give the address 
to a boolean variable.

Here is the code where I emit:

  gboolean b = TRUE;

  g_print ("before: %s\n", b?"true":"false");
  g_signal_emit (GTK_OBJECT (board),
		 signals[CAN_LIFT],
		 0,
		 SQUARE_COL(board,from), 
		 SQUARE_ROW(board,from),
		 &b );
  g_print ("after: %s\n", b?"true":"false");


When I have a signal handler it will set the variable b and everything is 
nice.

But my question is what happens when you don't have a any handler?

People at irc and the code of gtk itself (for example in gtkwidget.c)  
suggest that if you have no handler no-one will assign to the return
variable, and therefor if you set a default value before the emit it will
still be there after.

But this doesn't seem to happen. So either there is a bug in g_signal_emit 
that always assigns the return value, or there is a bug in gtk where code 
do assign to the variable before calling emit.

I have search the documentation to try to find out the intended behavior 
but no luck.

I did look at g_signal_emit() and to me it looks like the return value is 
always initialized, but there is too much code there that I'm not familiar 
with.

There is of course also a third possibility that I do something stupid
somewhere, but I'll assume (for now) that it is not the case here ;-)

-- 
/Dennis




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