Skip to content

Commit

Permalink
Merge branch 'master' into 'master'
Browse files Browse the repository at this point in the history
Fixes for JB#47814

See merge request mer-core/kf5-calendarcore!1
  • Loading branch information
blam committed Dec 18, 2020
2 parents 0b9bff3 + 7d1ee79 commit 78064ae
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
@@ -1,3 +1,3 @@
[submodule "upstream"]
path = upstream
url = git://invent.kde.org/frameworks/kcalendarcore
url = https://git.sailfishos.org/mirror/kcalendarcore.git
@@ -0,0 +1,44 @@
From cdc65b0c4fd5e76e97a5e732b4bd2e7f953c39a2 Mon Sep 17 00:00:00 2001
From: Bea Lam <bea.lam@jolla.com>
Date: Thu, 17 Dec 2020 16:16:15 +1000
Subject: [PATCH] Avoid forIncidences() template in deleteIncidenceInstances()

This causes the incidences list to be modified by deleteIncidence()
during the loop, which can cause a crash.
---
src/memorycalendar.cpp | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/memorycalendar.cpp b/src/memorycalendar.cpp
index 78e3665a9..ef1546c4f 100644
--- a/src/memorycalendar.cpp
+++ b/src/memorycalendar.cpp
@@ -240,16 +240,19 @@ bool MemoryCalendar::deleteIncidence(const Incidence::Ptr &incidence)

bool MemoryCalendar::deleteIncidenceInstances(const Incidence::Ptr &incidence)
{
- d->forIncidences<Incidence>(d->mIncidences[incidence->type()], incidence->uid(), [this](const Incidence::Ptr &incidence) {
- if (incidence->hasRecurrenceId()) {
+ auto instances = d->mIncidences[incidence->type()];
+ auto end = instances.cend();
+ for (auto it = instances.constFind(incidence->uid()); it != end && it.key() == incidence->uid(); ++it) {
+ if (it.value()->hasRecurrenceId()) {
qCDebug(KCALCORE_LOG) << "deleting child"
- << ", type=" << int(incidence->type())
- << ", uid=" << incidence->uid()
+ << ", type=" << int(it.value()->type())
+ << ", uid=" << it.value()->uid()
// << ", start=" << i->dtStart()
<< " from calendar";
- deleteIncidence(incidence);
+
+ deleteIncidence(it.value());
}
- });
+ }

return true;
}
--
2.24.3 (Apple Git-128)

1 change: 1 addition & 0 deletions rpm/kf5-calendarcore.spec
Expand Up @@ -17,6 +17,7 @@ BuildRequires: extra-cmake-modules >= 5.75.0
Patch1: 0001-Use-UTC-times-when-calculating-the-transition-dates-.patch
Patch2: 0002-Adjust-for-lower-Qt-versions.patch
Patch3: 0003-Add-pkgconfig-packaging.patch
Patch4: 0004-Avoid-forIncidences-template-in-deleteIncidenceInsta.patch

%description
KDE Framework calendar core library
Expand Down
2 changes: 1 addition & 1 deletion upstream
Submodule upstream updated from 4f00cd to 1ee30f

0 comments on commit 78064ae

Please sign in to comment.