From ecc2a18e1afc1b99df6725066c9ae552d09e90d8 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 30 Dec 2015 18:01:58 +0100 Subject: Centralize where we create the stores --- common/genericresource.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'common/genericresource.cpp') diff --git a/common/genericresource.cpp b/common/genericresource.cpp index 42153ec..29acce4 100644 --- a/common/genericresource.cpp +++ b/common/genericresource.cpp @@ -282,7 +282,9 @@ GenericResource::GenericResource(const QByteArray &resourceInstanceIdentifier, c QObject::connect(mProcessor, &CommandProcessor::error, [this](int errorCode, const QString &msg) { onProcessorError(errorCode, msg); }); QObject::connect(mPipeline.data(), &Pipeline::revisionUpdated, this, &Resource::revisionUpdated); mSourceChangeReplay = new ChangeReplay(resourceInstanceIdentifier, [this](const QByteArray &type, const QByteArray &key, const QByteArray &value) { - return this->replay(type, key, value); + //This results in a deadlock when a sync is in progress and we try to create a second writing transaction (which is why we turn changereplay off during the sync) + auto synchronizationStore = QSharedPointer::create(Akonadi2::storageLocation(), mResourceInstanceIdentifier + ".synchronization", Akonadi2::Storage::ReadWrite); + return this->replay(*synchronizationStore, type, key, value).then([synchronizationStore](){}); }); enableChangeReplay(true); mClientLowerBoundRevision = mPipeline->cleanedUpRevision(); @@ -317,7 +319,7 @@ void GenericResource::addType(const QByteArray &type, DomainTypeAdaptorFactoryIn mPipeline->setAdaptorFactory(type, factory); } -KAsync::Job GenericResource::replay(const QByteArray &type, const QByteArray &key, const QByteArray &value) +KAsync::Job GenericResource::replay(Akonadi2::Storage &synchronizationStore, const QByteArray &type, const QByteArray &key, const QByteArray &value) { return KAsync::null(); } -- cgit v1.2.3