diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-25 08:59:32 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-25 08:59:32 +0200 |
commit | 3cfb5e1485846799572147a3afd95afaa9755ed9 (patch) | |
tree | dbd79dd36a46825e5396a403f5b82fd36835fc21 /common/resourcecontrol.cpp | |
parent | da95c85de0b9f9b760845cc4b9911b79fbaafe9a (diff) | |
download | sink-3cfb5e1485846799572147a3afd95afaa9755ed9.tar.gz sink-3cfb5e1485846799572147a3afd95afaa9755ed9.zip |
Same fix as last commit.
Diffstat (limited to 'common/resourcecontrol.cpp')
-rw-r--r-- | common/resourcecontrol.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/common/resourcecontrol.cpp b/common/resourcecontrol.cpp index 678e6c0..437bf4b 100644 --- a/common/resourcecontrol.cpp +++ b/common/resourcecontrol.cpp | |||
@@ -57,11 +57,14 @@ KAsync::Job<void> ResourceControl::shutdown(const QByteArray &identifier) | |||
57 | future.setFinished(); | 57 | future.setFinished(); |
58 | return; | 58 | return; |
59 | } | 59 | } |
60 | QObject::connect(resourceAccess.data(), &ResourceAccess::ready, [&future](bool ready) { | 60 | auto guard = new QObject; |
61 | if (!ready) { | 61 | QObject::connect(resourceAccess.data(), &ResourceAccess::ready, guard, [&future](bool ready) { |
62 | future.setFinished(); | 62 | if (!ready) { |
63 | } | 63 | //Protect against callback getting called twice. |
64 | }); | 64 | delete guard; |
65 | future.setFinished(); | ||
66 | } | ||
67 | }); | ||
65 | }).then([time] { | 68 | }).then([time] { |
66 | SinkTrace() << "Shutdown complete." << Log::TraceTime(time->elapsed()); | 69 | SinkTrace() << "Shutdown complete." << Log::TraceTime(time->elapsed()); |
67 | }); | 70 | }); |