From f00915abed670248e5bd886b20e1f347b9b446ac5a2ae25574d8262918d460dd Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Wed, 2 Sep 2020 11:40:57 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/KDE:Applications/akonadi-server?expand=0&rev=250 --- 0001-AgentBase-Fix-crash-in-setOnline.patch | 69 +++++++++++++++++++++ akonadi-server.changes | 6 ++ akonadi-server.spec | 3 +- 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 0001-AgentBase-Fix-crash-in-setOnline.patch diff --git a/0001-AgentBase-Fix-crash-in-setOnline.patch b/0001-AgentBase-Fix-crash-in-setOnline.patch new file mode 100644 index 0000000..45a131c --- /dev/null +++ b/0001-AgentBase-Fix-crash-in-setOnline.patch @@ -0,0 +1,69 @@ +From 66d1135d127331fb3a2a7e047b0577d7e67d3dc2 Mon Sep 17 00:00:00 2001 +From: Ahmad Samir +Date: Wed, 2 Sep 2020 10:20:37 +0000 +Subject: [PATCH] AgentBase: Fix crash in setOnline + +When setOnline tries to access the mSettings member after the latter has +been deleted we get a crash; mSettings is deleted in quit() or cleanup(), +therefore it looks like a race condition: the Agent is about to quit, but +some other code calls setOnline leading to a crash. It looks like this can +happen in more than one way, e.g. via a dbus call (from AgentInstance), or +via a sub-class of AgentBase calling setOnline directly. Use a bool member +var, modelled after how AgentInstance uses a similar logic. + +BUG: 418844 +(cherry picked from commit 53574eb6fccc8f6a03dcea6c1ca1aa02dd895209) +--- + src/agentbase/agentbase.cpp | 8 ++++++++ + src/agentbase/agentbase_p.h | 2 ++ + 2 files changed, 10 insertions(+) + +diff --git a/src/agentbase/agentbase.cpp b/src/agentbase/agentbase.cpp +index 94d8ccc02..025f90c69 100644 +--- a/src/agentbase/agentbase.cpp ++++ b/src/agentbase/agentbase.cpp +@@ -333,6 +333,7 @@ AgentBasePrivate::AgentBasePrivate(AgentBase *parent) + , mNeedsNetwork(false) + , mOnline(false) + , mDesiredOnlineState(false) ++ , mPendingQuit(false) + , mSettings(nullptr) + , mChangeRecorder(nullptr) + , mTracer(nullptr) +@@ -1006,6 +1007,11 @@ void AgentBase::setNeedsNetwork(bool needsNetwork) + void AgentBase::setOnline(bool state) + { + Q_D(AgentBase); ++ ++ if (d->mPendingQuit) { ++ return; ++ } ++ + d->mDesiredOnlineState = state; + d->mSettings->setValue(QStringLiteral("Agent/DesiredOnlineState"), state); + setOnlineInternal(state); +@@ -1126,6 +1132,8 @@ void AgentBase::quit() + + void AgentBase::aboutToQuit() + { ++ Q_D(AgentBase); ++ d->mPendingQuit = true; + } + + void AgentBase::cleanup() +diff --git a/src/agentbase/agentbase_p.h b/src/agentbase/agentbase_p.h +index a70846ce9..2353e7281 100644 +--- a/src/agentbase/agentbase_p.h ++++ b/src/agentbase/agentbase_p.h +@@ -88,6 +88,8 @@ public: + bool mOnline; + bool mDesiredOnlineState; + ++ bool mPendingQuit; ++ + QSettings *mSettings = nullptr; + + ChangeRecorder *mChangeRecorder = nullptr; +-- +2.28.0 + diff --git a/akonadi-server.changes b/akonadi-server.changes index af025b4..c5682e7 100644 --- a/akonadi-server.changes +++ b/akonadi-server.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Sep 2 11:40:13 UTC 2020 - Christophe Giboudeaux + +- Add upstream patch to fix crashes: + * 0001-AgentBase-Fix-crash-in-setOnline.patch + ------------------------------------------------------------------- Tue Sep 1 20:48:47 UTC 2020 - Luca Beltrame diff --git a/akonadi-server.spec b/akonadi-server.spec index f67d9b6..72e8a4f 100644 --- a/akonadi-server.spec +++ b/akonadi-server.spec @@ -30,6 +30,7 @@ Group: System/GUI/KDE URL: https://akonadi-project.org Source: https://download.kde.org/stable/release-service/%{version}/src/%{rname}-%{version}.tar.xz Source99: akonadi-server-rpmlintrc +Patch0: 0001-AgentBase-Fix-crash-in-setOnline.patch BuildRequires: extra-cmake-modules >= %{kf5_version} BuildRequires: kf5-filesystem BuildRequires: libQt5Sql-private-headers-devel @@ -166,7 +167,7 @@ service. %lang_package %prep -%setup -q -n %{rname}-%{version} +%autosetup -p1 -n %{rname}-%{version} %build %cmake_kf5 -d build -- -DINSTALL_QSQLITE_IN_QT_PREFIX=TRUE -DQT_PLUGINS_DIR=%{_kf5_plugindir} -DINSTALL_APPARMOR=FALSE