From 6489d6db304fa759c42ae2e0728b2c5c8a1e53b0 Mon Sep 17 00:00:00 2001 From: Jehan Date: Tue, 14 Oct 2025 22:24:24 +0200 Subject: [PATCH] libgimpwidgets: consider NULL value of GimpLabelEntry as empty string. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. (cherry picked from commit faa288300fcf1b58398399c635cfac52e5ea7fff) --- libgimpwidgets/gimplabelentry.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libgimpwidgets/gimplabelentry.c b/libgimpwidgets/gimplabelentry.c index 196f68247c..c20fc63a23 100644 --- a/libgimpwidgets/gimplabelentry.c +++ b/libgimpwidgets/gimplabelentry.c @@ -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); }