From c2934be8485376571066a652e94ed16ba2bc8d81 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 2 Apr 2021 00:21:03 +0200 Subject: Cancel all tasks when pressing escape to go to previous page or when closing the window --- include/AsyncTask.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/AsyncTask.hpp') diff --git a/include/AsyncTask.hpp b/include/AsyncTask.hpp index 0d9c453..abdc0f8 100644 --- a/include/AsyncTask.hpp +++ b/include/AsyncTask.hpp @@ -26,6 +26,19 @@ namespace QuickMedia { return *this; } + AsyncTask(AsyncTask &&other) { + cancel(); + thread = std::move(other.thread); + future = std::move(other.future); + } + + AsyncTask& operator=(AsyncTask &&other) { + cancel(); + thread = std::move(other.thread); + future = std::move(other.future); + return *this; + } + ~AsyncTask() { cancel(); } -- cgit v1.2.3