From b334872e612433aee1284561fa247127bcdeeaf8 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 26 Mar 2018 13:34:43 +0200 Subject: Avoid triggering a fetch when a resource disconnects --- common/queryrunner.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'common/queryrunner.cpp') diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp index 73ccf6d..2c50fca 100644 --- a/common/queryrunner.cpp +++ b/common/queryrunner.cpp @@ -80,7 +80,11 @@ QueryRunner::QueryRunner(const Sink::Query &query, const Sink::Resou mResourceAccess->open(); QObject::connect(mResourceAccess.data(), &Sink::ResourceAccess::revisionChanged, this, &QueryRunner::revisionChanged); // open is not synchronous, so from the time when the initial query is started until we have started and connected to the resource, it's possible to miss updates. We therefore unconditionally try to fetch new entities once we are connected. - QObject::connect(mResourceAccess.data(), &Sink::ResourceAccess::ready, this, &QueryRunner::revisionChanged); + QObject::connect(mResourceAccess.data(), &Sink::ResourceAccess::ready, this, [this] (bool ready) { + if (ready) { + revisionChanged(); + } + }); } mResultProvider->onDone([this]() { delete this; -- cgit v1.2.3