Hello community,
here is the log from the commit of package akonadi-server for openSUSE:Factory checked in at 2019-04-05 11:55:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/akonadi-server (Old)
and /work/SRC/openSUSE:Factory/.akonadi-server.new.3908 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "akonadi-server"
Fri Apr 5 11:55:23 2019 rev:55 rq:691032 version:18.12.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/akonadi-server/akonadi-server.changes 2019-03-11 11:08:09.805737365 +0100
+++ /work/SRC/openSUSE:Factory/.akonadi-server.new.3908/akonadi-server.changes 2019-04-05 11:55:26.110281624 +0200
@@ -1,0 +2,7 @@
+Wed Apr 3 12:01:56 UTC 2019 - Luca Beltrame
From 53ad3b6d73d92ea289cf0183c10e2b8a35c8127a Mon Sep 17 00:00:00 2001 From: David Faure
Date: Thu, 21 Mar 2019 23:37:36 +0100 Subject: Fix collection detaching at the wrong time in attribute()
Summary:
Found in FatCRM where changes to collection attributes were not stored
anymore.
Test Plan:
New unittest to ensure that we get the attribute from the
detached collection, not from the original one.
Reviewers: dvratil
Reviewed By: dvratil
Subscribers: kde-pim
Tags: #kde_pim
Differential Revision: https://phabricator.kde.org/D19741
---
autotests/libs/collectionattributetest.cpp | 15 +++++++++++++++
autotests/libs/collectionattributetest.h | 1 +
src/core/collection.h | 8 ++------
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/autotests/libs/collectionattributetest.cpp b/autotests/libs/collectionattributetest.cpp
index e264a37..9c46561 100644
--- a/autotests/libs/collectionattributetest.cpp
+++ b/autotests/libs/collectionattributetest.cpp
@@ -240,3 +240,18 @@ void CollectionAttributeTest::testCollectionIdentificationAttribute()
QCOMPARE(parsed.identifier(), id);
QCOMPARE(parsed.collectionNamespace(), ns);
}
+
+void CollectionAttributeTest::testDetach()
+{
+ // GIVEN a collection with an attribute
+ Collection col;
+ col.attribute<TestAttribute>(Akonadi::Collection::AddIfMissing);
+ Collection col2 = col; // and a copy, so that non-const access detaches
+
+ // WHEN
+ TestAttribute *attr = col2.attribute<TestAttribute>(Akonadi::Collection::AddIfMissing);
+ TestAttribute *attr2 = col2.attribute<TestAttribute>();
+
+ // THEN
+ QCOMPARE(attr, attr2);
+}
diff --git a/autotests/libs/collectionattributetest.h b/autotests/libs/collectionattributetest.h
index 420df78..2afa9eb 100644
--- a/autotests/libs/collectionattributetest.h
+++ b/autotests/libs/collectionattributetest.h
@@ -32,6 +32,7 @@ private Q_SLOTS:
void testDefaultAttributes();
void testCollectionRightsAttribute();
void testCollectionIdentificationAttribute();
+ void testDetach();
};
#endif
diff --git a/src/core/collection.h b/src/core/collection.h
index b5a496c..9c19cc9 100644
--- a/src/core/collection.h
+++ b/src/core/collection.h
@@ -565,10 +565,10 @@ inline T *Akonadi::Collection::attribute(Collection::CreateOption option)
Q_UNUSED(option);
const T dummy;
+ markAttributesChanged();
if (hasAttribute(dummy.type())) {
T *attr = dynamic_cast
From 1d8851495bcfa6ff5d3fa35882b68fdf68b21a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Vr=C3=A1til?=
Date: Thu, 21 Mar 2019 13:22:58 +0100 Subject: Fix a regression when updating attributes
This fixes a regression introduced in 3a062e6a and 6054e42d where some
attributes were not sent to the Akonadi server in update job even though
they were modified. This was due to a bad API design which returns a
non-const pointer to an attribute from a const method, so callers sometimes
modify the returned attribute on a const object. Since the method itself
is const though, it did not mark the attribute as modified.
Proper fix is to introduce a purely const and non-const overloads for
the attribute accessors, unfortunatelly this requires fixing a lot of our code
in many places first to not abuse the non-constness of the returned
attribute.
Note that since the code is in an inlined method, all clients should be
recompiled.
CCMAIL: faure@kde.org
---
src/core/collection.h | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/core/collection.h b/src/core/collection.h
index 50c0926..b5a496c 100644
--- a/src/core/collection.h
+++ b/src/core/collection.h
@@ -584,14 +584,19 @@ inline T *Akonadi::Collection::attribute(Collection::CreateOption option)
template <typename T>
inline T *Akonadi::Collection::attribute() const
{
- const T dummy;
- if (hasAttribute(dummy.type())) {
- T *attr = dynamic_cast