From e03116bdd1d054822a4476c7806fb38d90f20f29 Mon Sep 17 00:00:00 2001 From: Steve Newson Date: Wed, 16 Sep 2020 18:23:30 +0100 Subject: [PATCH] Fix crash when hopping between years while still loading calendars The application crashes consistently for me if I switch to last year while the calendars are still loading. The error is: ``` GcalTimeline:ERROR:../src/core/gcal-timeline.c:593:on_calendar_monitor_completed_cb: assertion failed: (self->completed_calendars <= g_hash_table_size (self->calendars)) ``` This code change prevents the `completed_calendars` variable from being decremented. I can't see a reason why this value should ever need to be decremented (you can't uncomplete some calendars). A further thing to note is that `completed_calendars` is signed while `g_hash_table_size` returns an unsigned integer. The error here occurs because of the implicit casting (self->completed_calendars can be negative) I believe. --- src/core/gcal-timeline.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core/gcal-timeline.c b/src/core/gcal-timeline.c index 4a757af30..e26f6722e 100644 --- a/src/core/gcal-timeline.c +++ b/src/core/gcal-timeline.c @@ -587,8 +587,6 @@ on_calendar_monitor_completed_cb (GcalCalendarMonitor *monitor, if (gcal_calendar_monitor_is_complete (monitor)) self->completed_calendars++; - else - self->completed_calendars--; g_assert (self->completed_calendars <= g_hash_table_size (self->calendars)); -- GitLab