From da95c85de0b9f9b760845cc4b9911b79fbaafe9a Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 25 Jul 2018 08:54:40 +0200 Subject: Fixed crash. Could be triggered by running the composerviewtest in kube. --- common/store.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/store.cpp b/common/store.cpp index 0328c7f..b68cb68 100644 --- a/common/store.cpp +++ b/common/store.cpp @@ -312,8 +312,11 @@ KAsync::Job Store::removeDataFromDisk(const QByteArray &identifier) .then([resourceAccess](KAsync::Future &future) { if (resourceAccess->isReady()) { //Wait for the resource shutdown - QObject::connect(resourceAccess.data(), &ResourceAccess::ready, [&future](bool ready) { + auto guard = new QObject; + QObject::connect(resourceAccess.data(), &ResourceAccess::ready, guard, [&future, guard](bool ready) { if (!ready) { + //We don't disconnect if ResourceAccess get's recycled, so ready can fire multiple times, which can result in a crash if the future is no longer valid. + delete guard; future.setFinished(); } }); -- cgit v1.2.3