2012/9/13 Nick Hall <nick__hall@hotmail.com>
On 13/09/12 09:50, Benny Malengier wrote:
Ok, I now fully follow. The error
gramps.py:3315): Gtk-CRITICAL **: gtk_icon_set_render_icon_pixbuf: assertion `icon_set != NULL' failed
is due to the setting to '' of the stock column after break lock.

I see that for archive we also set '', so that will give errors also.
Looking into the code, we set None on build of the model. However, this means that in Gtk.py the column is just skipped when setting content. So in the low_level interface, there is nothing set, I suppose it will be NULL
We cannot set the value to NULL once it has been set to something. This should be allowed in some way, you should indeed open a bug ticket to pygobject to indicate this lack.
The only workaround I can see is to do delete of the row, then reset it with a None in the column, as this will cause the NULL value we need to avoid the error on the terminal.


The C documentation for the cell renderer does specify that the default value is NULL, which means no icon displayed.  The only problem at the moment is that we cannot pass None in the set_value method.



Alternative is that they override the cellrendererpixbuf, so that on stock_id == "", they assume this means NULL in some way.

There may be other reason why you may want to set a None value of a column.  I have only found one practical example so far.

You suggest some workarounds:

1. Create a transparent icon.

I actually quite like this.  The code would be very readable, and it would be easy to change when the bug is fixed.

2. Delete the row and re-insert it.

This would be slightly more difficult.

3. Use a set_cell_data_func method in a TreeViewColumn.

I actually have a patch to add a "private" column to views, which uses the set_cell_data_func to add a lock icon to columns.  I could give this a try in 4.0 (and apply it if you are interested).

I haven't actually tried passing a NULL GValue to the set_value method.  I'll give it a try.

I tried that, it doesn't work. There is no way to reach the set_value function of Gtk, we always hit the set_value function of the overridden Gtk (so in overrides/Gtk.py).
The function seems the best workaround for this.

Benny

I'll also report the bug.  It needs to be fixed.

Nick.