akonadi-server/Fix-crash-when-NotificationCollector-does-not-have-Connection.patch
Luca Beltrame 891d7de8cb 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
2018-08-28 08:55:55 +00:00

47 lines
1.9 KiB
Diff

From 0297248b0e768516236bdfeb55d04e8d4f4b1c80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= <dvratil@kde.org>
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<bool> ignoreTransactions(mIgnoreTransactions);
--
cgit v0.11.2