From c638e826787d154f9548dd0cb62d3c7d5346df93 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Fri, 17 May 2019 23:06:18 +0200 Subject: [PATCH] Qt: fix a crash when closing rpcs3 after downloading the compat database --- rpcs3/rpcs3qt/game_compatibility.cpp | 5 +++-- rpcs3/rpcs3qt/game_compatibility.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rpcs3/rpcs3qt/game_compatibility.cpp b/rpcs3/rpcs3qt/game_compatibility.cpp index 066676b330..b5db854dd6 100644 --- a/rpcs3/rpcs3qt/game_compatibility.cpp +++ b/rpcs3/rpcs3qt/game_compatibility.cpp @@ -127,7 +127,7 @@ void game_compatibility::RequestCompatibility(bool online) QNetworkReply* network_reply = m_network_access_manager->get(m_network_request); // 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->setFixedWidth(QLabel("This is the very length of the progressbar due to hidpi reasons.").sizeHint().width()); m_progress_dialog->setValue(0); @@ -154,7 +154,8 @@ void game_compatibility::RequestCompatibility(bool online) m_progress_timer->start(500); // 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 connect(network_reply, &QNetworkReply::downloadProgress, [&](qint64 bytesReceived, qint64 bytesTotal) diff --git a/rpcs3/rpcs3qt/game_compatibility.h b/rpcs3/rpcs3qt/game_compatibility.h index f59f402424..0ac06271a2 100644 --- a/rpcs3/rpcs3qt/game_compatibility.h +++ b/rpcs3/rpcs3qt/game_compatibility.h @@ -45,9 +45,9 @@ private: QString m_filepath; QString m_url; QNetworkRequest m_network_request; + progress_dialog* m_progress_dialog = nullptr; std::shared_ptr m_xgui_settings; std::unique_ptr m_progress_timer; - std::unique_ptr m_progress_dialog; std::unique_ptr m_network_access_manager; std::map m_compat_database;