From 63d573be73e5574f450d84686788fbbd4fa80c6c Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 28 Mar 2017 11:50:30 +0200 Subject: Guard against destruction We really need to guard against this in kasync... --- common/changereplay.cpp | 3 +++ common/changereplay.h | 1 + 2 files changed, 4 insertions(+) diff --git a/common/changereplay.cpp b/common/changereplay.cpp index 532cca8..4870551 100644 --- a/common/changereplay.cpp +++ b/common/changereplay.cpp @@ -99,6 +99,9 @@ KAsync::Job ChangeReplay::replayNextRevision() SinkTraceCtx(mLogCtx) << "Changereplay from " << *lastReplayedRevision << " to " << *topRevision; return KAsync::doWhile( [this, lastReplayedRevision, topRevision]() -> KAsync::Job { + if (!mGuard) { + return KAsync::value(KAsync::Break); + } if (*lastReplayedRevision >= *topRevision) { SinkTraceCtx(mLogCtx) << "Done replaying"; return KAsync::value(KAsync::Break); diff --git a/common/changereplay.h b/common/changereplay.h index 3ca896e..2772da9 100644 --- a/common/changereplay.h +++ b/common/changereplay.h @@ -63,6 +63,7 @@ private: bool mReplayInProgress; Sink::Storage::DataStore::Transaction mMainStoreTransaction; Sink::Log::Context mLogCtx; + QSharedPointer mGuard; }; class NullChangeReplay : public ChangeReplay -- cgit v1.2.3