akonadi-server/0001-Fix-crash-on-server-shutdown.patch
Luca Beltrame 829fd7a70f Accepting request 1083554 from home:krop:branches:KDE:Applications
- Add more fixes:
  * 0001-Avoid-crashing-before-priting-debug-output-when-sett.patch 
    (kde#468985)
  * 0001-Remove-dangling-reference.patch
  * 0001-Allow-running-mysql_upgrade-when-starting-Akonadi.patch
    (kde#402680)

- Add upstream changes:
  * 0001-Fix-wrong-for-clause-in-Akonadi-Session.patch (kde#458315)
  * 0002-Remove-dead-code-from-FavoriteCollectionsModel.patch
  * 0003-Fix-a-bug-in-for-clause-in-EntityTreeModel.patch
  * 0001-Fix-crash-on-server-shutdown.patch (kde#450217, kde#462692)

OBS-URL: https://build.opensuse.org/request/show/1083554
OBS-URL: https://build.opensuse.org/package/show/KDE:Applications/akonadi-server?expand=0&rev=340
2023-04-28 18:33:43 +00:00

40 lines
1.3 KiB
Diff

From 1d9d64ec3cf78dfdddc2239df0d33b08dc442104 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= <dvratil@kde.org>
Date: Sat, 22 Apr 2023 11:43:02 +0200
Subject: [PATCH] Fix crash on server shutdown
When AkonadiServer::quit() is called it clears the vector of existing
connections and destroys them. This can race with a resource disconnecting
or crashing on its own, which then enqueues a singal emission from the
Connection to remove itself from the connections vector as well.
Previously the code assumed the Connection must always exist in the vector
which caused a crash when it did not...surprise surprise.
BUG: 462692
FIXED-IN: 23.04.0
---
src/server/akonadi.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/server/akonadi.cpp b/src/server/akonadi.cpp
index 7ede9e238..5ff4a9c46 100644
--- a/src/server/akonadi.cpp
+++ b/src/server/akonadi.cpp
@@ -230,8 +230,10 @@ void AkonadiServer::connectionDisconnected()
auto it = std::find_if(mConnections.begin(), mConnections.end(), [this](const auto &ptr) {
return ptr.get() == sender();
});
- Q_ASSERT(it != mConnections.end());
- mConnections.erase(it);
+
+ if (it != mConnections.end()) {
+ mConnections.erase(it);
+ }
}
bool AkonadiServer::setupDatabase()
--
2.40.0