Use the recurrenceId to delete the right occurrence.
There is an issue at the moment when deleting an occurrence of a recurring event in the MemoryCalendar class. In the deleteIncidence()
function, the incidence to be deleted is looked for with a simple find()
on the incidence UID. But the recurrenceId is never checked to ensure that we're actually deleting the right incidence.
I'm adding a test demonstrating the issue.
It would have been possible to use find(uid, incidence)
instead of find(uid)
which would make the patch much smaller, but this requires that the incidence
argument is actually the stored pointer. The current implementation relying on searching for the incidence by its UID, implies that it may not the case. To be on the safe side, I've added a deleteIncidence()
function in the private implementation to actually look for a matching incidence with UID and recurrenceId and remove it when found.
I've also slightly reworked the deleteIncidenceInstances()
method because it was iterating on the mIncidences
multimap with a const iterator while is was actually modifying it with the call to deleteIncidence()
inside the loop.