Signals and malloced memory




	gtkeditable.h has the following comment in its class struct
definition, just above its list of virtual functions:

  /* Virtual functions. get_chars is in paricular not a signal because
   * it returns malloced memory. The others are not signals because
   * they would not be particularly useful as such. (All changes to
   * selection and position do not go through these functions)
   */

	My question is about "get_chars is in paricular not a signal
because it returns malloced memory".  This implies that I can't emit a
signal whose handler takes a pointer to something my object malloced.

	Is that true?  Why is that?  I want my text buffer object to emit
a "changed" signal whose handler looks something like:

  void (* changed)           (GtkEtextView *etext_view,
                              gint start_pos,
			      gint end_pos,
			      gint line_number,
			      gint column_number,
			      guint8 marks_flag,
			      GtkEtextStyle *style,
			      GtkEtextLine  *line);

	(Note that the above signature is contrived, I have not yet
decided on the final signature.  The point is that the changed signal will
provide everything the View needs to draw itself fast and efficiently,
including pointers to 'internal' structs in my text buffer)

	The first several args are normal, but the last two are pointers
to struct that I am going to allocate in my buffer object.  Is it true
that I cannot pass those?

	Whence the comment in gtkeditable.h?


Thanks,
Derek Simkowiak
dereks@kd-dev.com



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