From 442bf2f016dd1eb126370cbdd79c443d7743f750 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sat, 6 Jul 2013 15:34:59 +0000 Subject: [PATCH] create collate_key on demand git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/treeentry_gtk.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gtk/treeentry_gtk.c b/src/gtk/treeentry_gtk.c index 4c2e100bd7..f4f1b299af 100644 --- a/src/gtk/treeentry_gtk.c +++ b/src/gtk/treeentry_gtk.c @@ -79,6 +79,12 @@ gtk_tree_entry_get_type () gchar* gtk_tree_entry_get_collate_key (GtkTreeEntry* entry) { + if (entry->collate_key == NULL) + { + char* temp = g_utf8_casefold(entry->label, -1); + entry->collate_key = g_utf8_collate_key(temp, -1); + g_free(temp); + } return entry->collate_key; } @@ -96,7 +102,6 @@ gpointer gtk_tree_entry_get_userdata (GtkTreeEntry* entry) void gtk_tree_entry_set_label (GtkTreeEntry* entry, const gchar* label) { - gchar *temp; g_assert(GTK_IS_TREE_ENTRY(entry)); /* free previous if it exists */ @@ -107,9 +112,7 @@ void gtk_tree_entry_set_label (GtkTreeEntry* entry, const gchar* label } entry->label = g_strdup(label); - temp = g_utf8_casefold(label, -1); /* -1 == null terminated */ - entry->collate_key = g_utf8_collate_key(temp, -1); /* -1 == null terminated */ - g_free( temp ); + entry->collate_key = NULL; } void gtk_tree_entry_set_userdata (GtkTreeEntry* entry, gpointer userdata) -- 2.45.2