[evolution-data-server/gnome-3-38] DataCalView: Created objects could be notified twice
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-38] DataCalView: Created objects could be notified twice
- Date: Fri, 27 Nov 2020 15:53:44 +0000 (UTC)
commit d556d29a032850661f9a883acb19e37a88e60c2b
Author: Milan Crha <mcrha redhat com>
Date: Fri Nov 27 16:48:36 2020 +0100
DataCalView: Created objects could be notified twice
The backend could notify about created objects twice, in which case
the calendar view scheduled two identical objects for the client
notification, even only one was enough.
src/calendar/libedata-cal/e-data-cal-view.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/calendar/libedata-cal/e-data-cal-view.c b/src/calendar/libedata-cal/e-data-cal-view.c
index 93bd68308..26c2fe9d2 100644
--- a/src/calendar/libedata-cal/e-data-cal-view.c
+++ b/src/calendar/libedata-cal/e-data-cal-view.c
@@ -729,9 +729,14 @@ notify_add_component (EDataCalView *view,
/* const */ ECalComponent *comp)
{
ECalClientViewFlags flags;
- gchar *obj;
+ ECalComponentId *id;
- obj = e_data_cal_view_get_component_string (view, comp);
+ id = e_cal_component_get_id (comp);
+
+ if (!id || g_hash_table_lookup (view->priv->ids, id)) {
+ e_cal_component_id_free (id);
+ return;
+ }
send_pending_changes (view);
send_pending_removes (view);
@@ -739,17 +744,19 @@ notify_add_component (EDataCalView *view,
/* Do not send component add notifications during initial stage */
flags = e_data_cal_view_get_flags (view);
if (view->priv->complete || (flags & E_CAL_CLIENT_VIEW_FLAGS_NOTIFY_INITIAL) != 0) {
+ gchar *obj;
+
if (view->priv->adds->len == THRESHOLD_ITEMS)
send_pending_adds (view);
+
+ obj = e_data_cal_view_get_component_string (view, comp);
+
g_array_append_val (view->priv->adds, obj);
ensure_pending_flush_timeout (view);
}
- g_hash_table_insert (
- view->priv->ids,
- e_cal_component_get_id (comp),
- GUINT_TO_POINTER (1));
+ g_hash_table_insert (view->priv->ids, id, GUINT_TO_POINTER (1));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]