https://bugs.kde.org/show_bug.cgi?id=397629

M. Zili <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #7 from M. Zili <[email protected]> ---
I found one way to get exactly this message. It is in akonadi-calendar, not in
a
resource, which would fit it showing up with Google, ICS and other calendars
alike.
Could someone move this to Akonadi / Calendar library?

When a recurring event and its exception (a separate item with a RECURRENCE-ID)
are
removed from Akonadi together, every CalendarBase that holds both tries to
delete the
exception a second time, if the removal of the series is processed first (the
order
comes from the server, not from the job's item list):

1. CalendarBasePrivate::internalRemove() handles the series and calls
   q->MemoryCalendar::deleteIncidence(incidence) (calendarbase.cpp:249 on
master).
2. MemoryCalendar::deleteIncidence() calls deleteIncidenceInstances()
   (memorycalendar.cpp:207), which calls deleteIncidence(instance) for each
exception
   (memorycalendar.cpp:234).
3. That call is virtual and lands in CalendarBase::deleteIncidence(), which
passes the
   exception to the IncidenceChanger: a real ItemDeleteJob.
4. The item is already gone, the job fails, and the IncidenceChanger shows
"Error while
   trying to delete calendar item. Error was: No items found".

This happens once per CalendarBase instance: for me three dialogs from
KOrganizer plus
one failed DeleteItems from kalendarac, for a single series. With many series
removed
at once this could add up to the number of pop-ups described here.

Steps to reproduce:
1. Run KOrganizer with any writable calendar.
2. Create a recurring event and change one occurrence ("Only this occurrence").
3. From another Akonadi client, delete the series item and the exception item
in one
   ItemDeleteJob.
The DAV resource does the same during a sync when the object is gone on the
server
(exceptions are separate items there and are removed together with the main
item).
Deleting the series in KOrganizer itself ("delete all") did not show the error
for me.
Removing a whole calendar that holds such series triggers it too: removing a
test
calendar with two series, each with one exception, brought up six of these
dialogs.

The same detour also deletes data. internalRemove() is called as well when
items only
leave the model (calendar unchecked, model reset). Then the exception item
still exists
and the implicit delete succeeds. Verified: in a local iCal test calendar with
one
series and one exception, unchecking the calendar in KOrganizer removed the
exception
item from Akonadi and from the .ics file; the series item stayed. With a
calendar that
syncs to a server, the resource would replay that delete to the server.

Reproduced with akonadi-calendar 26.08.3, KCalendarCore 6.32.0, Akonadi
26.08.3.
Akonadi master/26.12 no longer fails a delete of missing items (a3b5dc08,
!420), so the
dialogs should be gone there. The implicit delete is still in akonadi-calendar
master
(4e6aee9).

Possible fix: let internalRemove() take the exceptions of a series out of
memory itself
before handing the series to MemoryCalendar, so nothing is routed back into
CalendarBase::deleteIncidence():

    // in CalendarBasePrivate::internalRemove(), before
q->Calendar::setObserversEnabled(false)
    if (!incidence->hasRecurrenceId() && incidence->recurs()) {
        const auto instances = q->instances(incidence);
        for (const auto &instance : instances) {
            const Akonadi::Item::Id id =
mItemIdByUid.value(instance->instanceIdentifier(), -1);
            if (id != -1) {
                internalRemove(mItemById.value(id));
            }
        }
    }

Behaviour change: if someone removes only the series item and leaves its
exception
items in Akonadi, they would stay there as orphans instead of being deleted by
every
CalendarBase. KOrganizer and the DAV resource delete the exceptions explicitly,
so they
do not rely on that.

I can turn this into a merge request with a test if that direction is
acceptable, and
file the data loss as a separate bug if you prefer.

Kopiere nur den Inhalt des Blocks, ohne die Backtick-Zeilen, und füge ihn auf
https://bugs.kde.org/show_bug.cgi?id=397629 ins Kommentarfeld ein.

Falls du einen KI-Hinweis anfügen willst, hänge diese Zeile ans Ende:

Disclosure: the analysis was done with AI assistance; I reproduced the
behaviour myself.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to