Skip to content

Unregister MemoryCalendar as an observer when deleting an incidence.

Damien Caliste requested to merge dcaliste/kcalendarcore:unregister into master

Not of the highest importance, but in my opinion, when deleting an incidence from a MemoryCalendar, the memory calendar object which is registered as an observer in the addIncidence() function is not unregistered in deleteIncidence().

If no other pointer exists on the deleted incidence, the observer will be deleted when the incidence is freed. But if something is keeping a QSharedPointer on the incidence, then the memory calendar will continue to trigger its incidenceUpdate() and incidenceUpdated() routines when the incidence is modified. Then again, it does not matter much because in these callbacks, the incidence is checked to be part of the memory calendar otherwise the callbacks do nothing. So there is actually no bug.

But it's inelegant. In addition, in deleteAllIncidences() the memory calendar is unregistered for every incidences in is storing. So why not doing it also on single incidence deletion ?

@winterz what do you think ?

Merge request reports