From 62cb532460d504533c2c3cbf5b32a8c1249d70a3 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Mon, 18 Jan 2021 22:01:13 +0100 Subject: [PATCH] Qt: hotfix for downloader I accidentally broke the download progress bar in the last related PR. I should've put more trust in the sanity of the younger version of myself. This should fix it. --- rpcs3/rpcs3qt/downloader.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rpcs3/rpcs3qt/downloader.cpp b/rpcs3/rpcs3qt/downloader.cpp index a5c3ceaf11..94ff08bec9 100644 --- a/rpcs3/rpcs3qt/downloader.cpp +++ b/rpcs3/rpcs3qt/downloader.cpp @@ -21,14 +21,13 @@ downloader::downloader(QWidget* parent) , m_parent(parent) , m_curl(new curl_handle(this)) { - connect(this, &downloader::signal_buffer_update, this, &downloader::handle_buffer_update); } downloader::~downloader() { - m_curl_abort = true; if (m_thread && m_thread->isRunning()) { + m_curl_abort = true; m_thread->wait(); } } @@ -37,9 +36,9 @@ void downloader::start(const std::string& url, bool follow_location, bool show_p { if (m_thread) { - m_curl_abort = true; if (m_thread->isRunning()) { + m_curl_abort = true; m_thread->wait(); } m_thread->deleteLater(); @@ -86,6 +85,10 @@ void downloader::start(const std::string& url, bool follow_location, bool show_p } }); + // The downloader's signals are expected to be disconnected and customized before start is called. + // Therefore we need to (re)connect its signal(s) here and not in the constructor. + connect(this, &downloader::signal_buffer_update, this, &downloader::handle_buffer_update); + if (show_progress_dialog) { const int maximum = exptected_size > 0 ? exptected_size : 100;