Qt: don't close the progress dialog if it is already being closed anyway

Maybe this fixes some strange crashes that appear for some people.
This commit is contained in:
Megamouse 2024-03-09 14:31:36 +01:00
parent 86ad4ed6c1
commit be5b982e45
2 changed files with 6 additions and 5 deletions

View File

@ -122,10 +122,13 @@ void downloader::start(const std::string& url, bool follow_location, bool show_p
connect(m_progress_dialog, &QProgressDialog::canceled, this, [this]()
{
m_curl_abort = true;
close_progress_dialog();
m_progress_dialog = nullptr; // The progress dialog deletes itself on close
Q_EMIT signal_download_canceled();
});
connect(m_progress_dialog, &QProgressDialog::finished, this, &downloader::close_progress_dialog);
connect(m_progress_dialog, &QProgressDialog::finished, this, [this]()
{
m_progress_dialog = nullptr; // The progress dialog deletes itself on close
});
}
}

View File

@ -25,12 +25,10 @@ public:
usz update_buffer(char* data, usz size);
void update_progress_dialog(const QString& title) const;
void close_progress_dialog();
progress_dialog* get_progress_dialog() const;
public Q_SLOTS:
void close_progress_dialog();
private Q_SLOTS:
void handle_buffer_update(int size, int max) const;