From 7d976a9c3eaa3ed0b48aa1c000312e78c3a8b0b6 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Wed, 9 Apr 2003 10:15:05 +0000 Subject: [ fixes #40727 ] if the query text is either shorter than the cached 2003-04-09 Chris Toshok [ fixes #40727 ] * gui/component/select-names/e-select-names-completion.c (e_select_names_completion_start_query): if the query text is either shorter than the cached query_text or they don't match, don't just set can_reuse_cached_cards to FALSE. we also need to invalidate the cache. svn path=/trunk/; revision=20780 --- .../gui/component/select-names/e-select-names-completion.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'addressbook/gui') diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c index 81f5d12353..06e890f468 100644 --- a/addressbook/gui/component/select-names/e-select-names-completion.c +++ b/addressbook/gui/component/select-names/e-select-names-completion.c @@ -661,7 +661,6 @@ e_select_names_completion_clear_book_data (ESelectNamesCompletion *comp) g_list_foreach (book_data->cached_cards, (GFunc)g_object_unref, NULL); g_list_free (book_data->cached_cards); - g_free (book_data); } g_list_free (comp->priv->book_data); @@ -945,12 +944,17 @@ e_select_names_completion_start_query (ESelectNamesCompletion *comp, const gchar book_data->cached_cards); } + /* for lack of a better place, we invalidate the cache here if we + notice that the text is different. */ + if (book_data->cached_query_text + && (strlen (book_data->cached_query_text) > strlen (query_text) + || utf8_casefold_collate_len (book_data->cached_query_text, query_text, + strlen (book_data->cached_query_text)))) + book_data->cache_complete = FALSE; + can_reuse_cached_cards = (book_data->cached_query_text && book_data->cache_complete - && book_data->cached_cards != NULL - && (strlen (book_data->cached_query_text) <= strlen (query_text)) - && !utf8_casefold_collate_len (book_data->cached_query_text, query_text, - strlen (book_data->cached_query_text))); + && book_data->cached_cards != NULL); if (can_reuse_cached_cards) { -- cgit