libgimpwidgets: consider NULL value of GimpLabelEntry as empty string.
Fixes: > (file-svg:125356): Gtk-CRITICAL **: 22:11:43.459: gtk_entry_buffer_set_text: assertion 'chars != NULL' failed … when running file-svg-export because the default of the "title" string argument is NULL. I did hesitate considering this was a bug in file-svg code on the premises that a NULL value was not valid (hence replacing it as ""), but in the end, I went with the more flexible solution, which is that NULL is considered equivalent to "". So GimpLabelEntry code will just transform the NULL pointer internally to an empty string.
This commit is contained in:
parent
c5cdea4842
commit
faa288300f
1 changed files with 6 additions and 4 deletions
|
|
@ -150,14 +150,16 @@ gimp_label_entry_set_property (GObject *object,
|
|||
{
|
||||
case PROP_VALUE:
|
||||
{
|
||||
GtkEntryBuffer *buffer = gtk_entry_get_buffer (GTK_ENTRY (entry->entry));
|
||||
GtkEntryBuffer *buffer = gtk_entry_get_buffer (GTK_ENTRY (entry->entry));
|
||||
const gchar *new_text = g_value_get_string (value);
|
||||
const gchar *text = gtk_entry_buffer_get_text (buffer);
|
||||
|
||||
/* Avoid looping forever since we have bound this widget's
|
||||
* "value" property with the entry button "value" property.
|
||||
*/
|
||||
if (g_strcmp0 (gtk_entry_buffer_get_text (buffer),
|
||||
g_value_get_string (value)) != 0)
|
||||
gtk_entry_buffer_set_text (buffer, g_value_get_string (value), -1);
|
||||
if ((new_text == NULL && g_strcmp0 (text, "") != 0) ||
|
||||
(new_text != NULL && g_strcmp0 (text, new_text) != 0))
|
||||
gtk_entry_buffer_set_text (buffer, new_text ? new_text : "", -1);
|
||||
|
||||
g_signal_emit (object, gimp_label_entry_signals[VALUE_CHANGED], 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue