From 891d7de8cbe763007cabc39171026d76b44301d835f644adca01ce9507d02e51 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Tue, 28 Aug 2018 08:55:55 +0000 Subject: [PATCH] Accepting request 631926 from home:wolfi323:branches:KDE:Applications - Add upstream patch to fix crashes under certain circumstances, e.g. when searching: (kde#397239) * Fix-crash-when-NotificationCollector-does-not-have-Connection.patch OBS-URL: https://build.opensuse.org/request/show/631926 OBS-URL: https://build.opensuse.org/package/show/KDE:Applications/akonadi-server?expand=0&rev=161 --- ...onCollector-does-not-have-Connection.patch | 46 +++++++++++++++++++ akonadi-server.changes | 7 +++ akonadi-server.spec | 3 ++ 3 files changed, 56 insertions(+) create mode 100644 Fix-crash-when-NotificationCollector-does-not-have-Connection.patch diff --git a/Fix-crash-when-NotificationCollector-does-not-have-Connection.patch b/Fix-crash-when-NotificationCollector-does-not-have-Connection.patch new file mode 100644 index 0000000..ff1f1bc --- /dev/null +++ b/Fix-crash-when-NotificationCollector-does-not-have-Connection.patch @@ -0,0 +1,46 @@ +From 0297248b0e768516236bdfeb55d04e8d4f4b1c80 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= +Date: Mon, 27 Aug 2018 23:26:02 +0200 +Subject: Fix crash when NotificationCollector does not have Connection + +This can happen when the NotificationCollector is invoked internally +for instance from the SearchManager. + +BUG: 397239 +FIXED-IN: 5.9.1 +--- + src/server/connection.cpp | 4 +++- + src/server/storage/notificationcollector.cpp | 2 +- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/server/connection.cpp b/src/server/connection.cpp +index 832cc67..3e1f43d 100644 +--- a/src/server/connection.cpp ++++ b/src/server/connection.cpp +@@ -79,7 +79,9 @@ Connection::Connection(quintptr socketDescriptor, QObject *parent) + + Connection *Connection::self() + { +- Q_ASSERT(sConnectionStore->hasLocalData()); ++ if (!sConnectionStore->hasLocalData()) { ++ return nullptr; ++ } + return sConnectionStore->localData(); + } + +diff --git a/src/server/storage/notificationcollector.cpp b/src/server/storage/notificationcollector.cpp +index 4c70141..b92ee96 100644 +--- a/src/server/storage/notificationcollector.cpp ++++ b/src/server/storage/notificationcollector.cpp +@@ -535,7 +535,7 @@ void NotificationCollector::completeNotification(const Protocol::ChangeNotificat + // we emit a notification without it and leave it up to the Monitor + // to retrieve the Item on demand - we should have a RID stored in + // Akonadi by then. +- if (allHaveRID || msg->operation() != Protocol::ItemChangeNotification::Add) { ++ if (Connection::self() && (allHaveRID || msg->operation() != Protocol::ItemChangeNotification::Add)) { + + // Prevent transactions inside FetchHelper to recursively call our slot + QScopedValueRollback ignoreTransactions(mIgnoreTransactions); +-- +cgit v0.11.2 + diff --git a/akonadi-server.changes b/akonadi-server.changes index b36ea58..5588d59 100644 --- a/akonadi-server.changes +++ b/akonadi-server.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Aug 28 08:35:13 UTC 2018 - wbauer@tmo.at + +- Add upstream patch to fix crashes under certain circumstances, + e.g. when searching: (kde#397239) + * Fix-crash-when-NotificationCollector-does-not-have-Connection.patch + ------------------------------------------------------------------- Thu Aug 16 21:59:56 UTC 2018 - christophe@krop.fr diff --git a/akonadi-server.spec b/akonadi-server.spec index 9729651..77ffa42 100644 --- a/akonadi-server.spec +++ b/akonadi-server.spec @@ -31,6 +31,8 @@ Group: System/GUI/KDE Url: http://akonadi-project.org Source: %{rname}-%{version}.tar.xz Source99: akonadi-server-rpmlintrc +# PATCH-FIX-UPSTREAM +Patch: Fix-crash-when-NotificationCollector-does-not-have-Connection.patch %if 0%{?suse_version} > 1325 BuildRequires: libboost_graph-devel BuildRequires: libboost_headers-devel @@ -182,6 +184,7 @@ service. %prep %setup -q -n %{rname}-%{version} +%patch -p1 %build %if 0%{?suse_version} < 1330