Bug in gtk_clist_get_pixtext in 1.0.4



Hi. I was just playing wit the clist example from the online tutorial. 
After changing the cells from type text to type pixtext, I found a bug
in gtk_clist_get_pixtext (in gtk+ 1.0.4).  

The tutorial says:

>>
It isn't necessary to read it all back in case you aren't interested.
Any of the pointers that are meant for return values (all except the
clist) can be
NULL.  ...

       gtk_clist_get_pixtext(clist, row, column, &mytext, NULL, NULL,
NULL);

<<

However, this results in a SIGINT.  The problem is with the mask
parameter as follows:

Line 1116 of gtkclist.c should read:

	if (mask) 

instead of:

	/* mask can be NULL */

Changing the line definitely fixes the SIGINT.

The entire function should look like this:

>>

gint
gtk_clist_get_pixtext (GtkCList * clist,
		       gint row,
		       gint column,
		       gchar ** text,
		       guint8 * spacing,
		       GdkPixmap ** pixmap,
		       GdkBitmap ** mask)
{
  GtkCListRow *clist_row;

  g_return_val_if_fail (clist != NULL, 0);

  if (row < 0 || row >= clist->rows)
    return 0;
  if (column < 0 || column >= clist->columns)
    return 0;

  clist_row = (g_list_nth (clist->row_list, row))->data;

  if (clist_row->cell[column].type != GTK_CELL_PIXTEXT)
    return 0;

  if (text)
    *text = GTK_CELL_PIXTEXT (clist_row->cell[column])->text;
  if (spacing)
    *spacing = GTK_CELL_PIXTEXT (clist_row->cell[column])->spacing;
  if (pixmap)
    *pixmap = GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap;
  if (mask)   /* <------------ This line is missing */
    *mask = GTK_CELL_PIXTEXT (clist_row->cell[column])->mask;

  return 1;
}

<<


~p@



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