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 --- src/GoogleCaptcha.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/GoogleCaptcha.cpp') diff --git a/src/GoogleCaptcha.cpp b/src/GoogleCaptcha.cpp index 3bd91eb..137eb24 100644 --- a/src/GoogleCaptcha.cpp +++ b/src/GoogleCaptcha.cpp @@ -99,8 +99,8 @@ namespace QuickMedia { return strip_html_tags(html_source.substr(start_index, end_index - start_index)); } - std::future google_captcha_request_challenge(const std::string &api_key, const std::string &referer, RequestChallengeResponse challenge_response_callback) { - return std::async(std::launch::async, [challenge_response_callback, api_key, referer]() { + AsyncTask google_captcha_request_challenge(const std::string &api_key, const std::string &referer, RequestChallengeResponse challenge_response_callback) { + return AsyncTask([challenge_response_callback, api_key, referer]() { std::string captcha_url = "https://www.google.com/recaptcha/api/fallback?k=" + api_key; std::string response; std::vector additional_args = { @@ -131,8 +131,8 @@ namespace QuickMedia { return result; } - std::future google_captcha_post_solution(const std::string &api_key, const std::string &captcha_id, std::array selected_images, PostSolutionResponse solution_response_callback) { - return std::async(std::launch::async, [solution_response_callback, api_key, captcha_id, selected_images]() { + AsyncTask google_captcha_post_solution(const std::string &api_key, const std::string &captcha_id, std::array selected_images, PostSolutionResponse solution_response_callback) { + return AsyncTask([solution_response_callback, api_key, captcha_id, selected_images]() { std::string captcha_url = "https://www.google.com/recaptcha/api/fallback?k=" + api_key; std::string response; std::vector additional_args = { -- cgit v1.2.3