Bug in gtkclist: cell_set_text and friends.

In the copy of gtkclist.c I have, cell_set_text cell_set_pixtext, and
perhaps others all free the current string before storing the new
one.  This makes the following code segfault:

  gtk_clist_get_text(cl, row, col, &text);
  gtk_clist_set_text(cl, row, col, text);

Is this intentional?  It seems reasonable to have gtk_clist_set*text()
check to see if the string argument is the same pointer the one
already in the cell.  If so, then it shouldn't try to free it.

Now I know that the above code is just a no-op, but aside from making
the interface more robust, and keeping the user from having to check
all the pointers carefully, what about the case where you're trying to
change a cell from text to pixtext like this:

  gtk_clist_get_text(cl, row, col, &text);
  gtk_clist_set_pixtext(cl, row, col, text, spacing, pixmap, mask);

I believe this will also segfault.


Rob Browning <rlb@cs.utexas.edu>
PGP fingerprint = E8 0E 0D 04 F5 21 A0 94  53 2B 97 F5 D6 4E 39 30

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