diff options
Diffstat (limited to 'common')
-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 | }); |