[gimp] app: small improvement to previous GimpPaletteEditor commit



commit aeec0f7f49e5b554ff3d177ae88338d25bcb2243
Author: Michael Natterer <mitch gimp org>
Date:   Mon Jul 9 22:12:55 2018 +0200

    app: small improvement to previous GimpPaletteEditor commit

 app/widgets/gimppaletteeditor.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/app/widgets/gimppaletteeditor.c b/app/widgets/gimppaletteeditor.c
index 68220efade..29f0e1bbd7 100644
--- a/app/widgets/gimppaletteeditor.c
+++ b/app/widgets/gimppaletteeditor.c
@@ -771,17 +771,19 @@ palette_editor_entry_selected (GimpPaletteView   *view,
                                GimpPaletteEditor *editor)
 {
   GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
-  gchar          *index       = NULL;
 
   if (editor->color != entry)
     {
+      gchar index[8];
+
       editor->color = entry;
 
       if (entry)
-        index = g_strdup_printf("%04i", entry->position);
-      gtk_label_set_text (GTK_LABEL (editor->index_label),
-                          entry ? index : "####");
-      g_free (index);
+        g_snprintf (index, sizeof (index), "%04i", entry->position);
+      else
+        g_snprintf (index, sizeof (index), "####");
+
+      gtk_label_set_text (GTK_LABEL (editor->index_label), index);
 
       g_signal_handlers_block_by_func (editor->color_name,
                                        palette_editor_color_name_changed,


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