Qt: fix a crash when closing rpcs3 after downloading the compat database

This commit is contained in:
Megamouse 2019-05-17 23:06:18 +02:00
parent fb1d8cb548
commit c638e82678
2 changed files with 4 additions and 3 deletions

View File

@ -127,7 +127,7 @@ void game_compatibility::RequestCompatibility(bool online)
QNetworkReply* network_reply = m_network_access_manager->get(m_network_request); QNetworkReply* network_reply = m_network_access_manager->get(m_network_request);
// Show Progress // Show Progress
m_progress_dialog.reset(new progress_dialog(tr(".Please wait."), tr("Abort"), 0, 100)); m_progress_dialog = new progress_dialog(tr(".Please wait."), tr("Abort"), 0, 100);
m_progress_dialog->setWindowTitle(tr("Downloading Database")); m_progress_dialog->setWindowTitle(tr("Downloading Database"));
m_progress_dialog->setFixedWidth(QLabel("This is the very length of the progressbar due to hidpi reasons.").sizeHint().width()); m_progress_dialog->setFixedWidth(QLabel("This is the very length of the progressbar due to hidpi reasons.").sizeHint().width());
m_progress_dialog->setValue(0); m_progress_dialog->setValue(0);
@ -154,7 +154,8 @@ void game_compatibility::RequestCompatibility(bool online)
m_progress_timer->start(500); m_progress_timer->start(500);
// Handle abort // Handle abort
connect(m_progress_dialog.get(), &QProgressDialog::canceled, network_reply, &QNetworkReply::abort); connect(m_progress_dialog, &QProgressDialog::canceled, network_reply, &QNetworkReply::abort);
connect(m_progress_dialog, &QProgressDialog::finished, m_progress_dialog, &QProgressDialog::deleteLater);
// Handle progress // Handle progress
connect(network_reply, &QNetworkReply::downloadProgress, [&](qint64 bytesReceived, qint64 bytesTotal) connect(network_reply, &QNetworkReply::downloadProgress, [&](qint64 bytesReceived, qint64 bytesTotal)

View File

@ -45,9 +45,9 @@ private:
QString m_filepath; QString m_filepath;
QString m_url; QString m_url;
QNetworkRequest m_network_request; QNetworkRequest m_network_request;
progress_dialog* m_progress_dialog = nullptr;
std::shared_ptr<gui_settings> m_xgui_settings; std::shared_ptr<gui_settings> m_xgui_settings;
std::unique_ptr<QTimer> m_progress_timer; std::unique_ptr<QTimer> m_progress_timer;
std::unique_ptr<progress_dialog> m_progress_dialog;
std::unique_ptr<QNetworkAccessManager> m_network_access_manager; std::unique_ptr<QNetworkAccessManager> m_network_access_manager;
std::map<std::string, compat_status> m_compat_database; std::map<std::string, compat_status> m_compat_database;