diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-21 18:01:05 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-23 17:37:53 +0200 |
commit | 5b64da01a381aca6890490fc92ef704f4342eb7e (patch) | |
tree | 1e7c631e49c2e02a149725b1c923e73d16fdcc96 | |
parent | f0576e8a7ef4493bd551e04dbb4c29f88fa7a25b (diff) | |
download | sink-5b64da01a381aca6890490fc92ef704f4342eb7e.tar.gz sink-5b64da01a381aca6890490fc92ef704f4342eb7e.zip |
Copy the identifier as well.
Otherwise the value could silently start to point to invalid memory.
-rw-r--r-- | common/domain/applicationdomaintype.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index a581068..ad2d7a1 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h | |||
@@ -73,7 +73,8 @@ public: | |||
73 | { | 73 | { |
74 | //TODO only copy requested properties | 74 | //TODO only copy requested properties |
75 | auto memoryAdaptor = QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create(*(domainType.mAdaptor)); | 75 | auto memoryAdaptor = QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create(*(domainType.mAdaptor)); |
76 | return QSharedPointer<DomainType>::create(domainType.mResourceInstanceIdentifier, domainType.mIdentifier, domainType.mRevision, memoryAdaptor); | 76 | //The identifier still internal refers to the memory-mapped pointer, we need to copy the memory or it will become invalid |
77 | return QSharedPointer<DomainType>::create(domainType.mResourceInstanceIdentifier, QByteArray(domainType.mIdentifier.constData()), domainType.mRevision, memoryAdaptor); | ||
77 | } | 78 | } |
78 | 79 | ||
79 | virtual ~ApplicationDomainType() {} | 80 | virtual ~ApplicationDomainType() {} |