[gnome-calendar] search-view: only decrease search counter when something is removed
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] search-view: only decrease search counter when something is removed
- Date: Tue, 24 Jan 2017 11:01:21 +0000 (UTC)
commit 53f9158f25eb59f18d52e45f9adb5c013f467b75
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Jan 24 08:59:00 2017 -0200
search-view: only decrease search counter when something is removed
Because we were blindlessly decreasing the search hit counter without
considering that we could've not removed anything, the search hit
counter is going nuts.
Fix that by properly checking if something was removed, and only decrease
the search hit counter when that happens.
src/gcal-search-view.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/src/gcal-search-view.c b/src/gcal-search-view.c
index 4100a60..f5ad356 100644
--- a/src/gcal-search-view.c
+++ b/src/gcal-search-view.c
@@ -638,22 +638,27 @@ gcal_search_view_component_removed (ECalDataModelSubscriber *subscriber,
else
uuid = g_strdup_printf ("%s:%s", e_source_get_uid (source), uid);
- // Lookup the RowEventData
+ /* Lookup the RowEventData */
row_data = g_hash_table_lookup (view->uuid_to_event, uuid);
- /* Removing the given RowEventData entry will
- * call free_row_data, which removes the row
- * from the listbox and also free the uuid.
- */
- if (row_data)
- g_hash_table_remove (view->uuid_to_event, uuid);
+ /* We didn't add this event, so there's nothing to do */
+ if (!row_data)
+ goto out;
- g_free (uuid);
+ /*
+ * Removing the given RowEventData entry will call free_row_data(),
+ * which removes the row from the listbox and also frees the hashtable's
+ * uuid.
+ */
+ g_hash_table_remove (view->uuid_to_event, uuid);
/* show 'no results' */
view->num_results--;
update_view (GCAL_SEARCH_VIEW (subscriber));
+
+out:
+ g_free (uuid);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]