Removed RunOnObject() usage to prevent deadlock on exiting the NetPlay Session Browser dialog.
This commit is contained in:
parent
eee1589aa3
commit
ddeb2236ae
|
@ -26,7 +26,6 @@
|
|||
#include "Core/ConfigManager.h"
|
||||
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
#include "DolphinQt/QtUtils/RunOnObject.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
NetPlayBrowser::NetPlayBrowser(QWidget* parent) : QDialog(parent)
|
||||
|
@ -148,6 +147,11 @@ void NetPlayBrowser::ConnectWidgets()
|
|||
connect(m_table_widget, &QTableWidget::itemSelectionChanged, this,
|
||||
&NetPlayBrowser::OnSelectionChanged);
|
||||
connect(m_table_widget, &QTableWidget::itemDoubleClicked, this, &NetPlayBrowser::accept);
|
||||
|
||||
connect(this, &NetPlayBrowser::UpdateStatusRequested, this,
|
||||
&NetPlayBrowser::OnUpdateStatusRequested, Qt::QueuedConnection);
|
||||
connect(this, &NetPlayBrowser::UpdateListRequested, this, &NetPlayBrowser::OnUpdateListRequested,
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void NetPlayBrowser::Refresh()
|
||||
|
@ -191,10 +195,7 @@ void NetPlayBrowser::RefreshLoop()
|
|||
|
||||
lock.unlock();
|
||||
|
||||
RunOnObject(this, [this] {
|
||||
m_status_label->setText(tr("Refreshing..."));
|
||||
return nullptr;
|
||||
});
|
||||
emit UpdateStatusRequested(tr("Refreshing..."));
|
||||
|
||||
NetPlayIndex client;
|
||||
|
||||
|
@ -202,19 +203,12 @@ void NetPlayBrowser::RefreshLoop()
|
|||
|
||||
if (entries)
|
||||
{
|
||||
RunOnObject(this, [this, &entries] {
|
||||
m_sessions = *entries;
|
||||
UpdateList();
|
||||
return nullptr;
|
||||
});
|
||||
emit UpdateListRequested(std::move(*entries));
|
||||
}
|
||||
else
|
||||
{
|
||||
RunOnObject(this, [this, &client] {
|
||||
m_status_label->setText(tr("Error obtaining session list: %1")
|
||||
.arg(QString::fromStdString(client.GetLastError())));
|
||||
return nullptr;
|
||||
});
|
||||
emit UpdateStatusRequested(tr("Error obtaining session list: %1")
|
||||
.arg(QString::fromStdString(client.GetLastError())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -277,6 +271,17 @@ void NetPlayBrowser::OnSelectionChanged()
|
|||
->setEnabled(!m_table_widget->selectedItems().isEmpty());
|
||||
}
|
||||
|
||||
void NetPlayBrowser::OnUpdateStatusRequested(const QString& status)
|
||||
{
|
||||
m_status_label->setText(status);
|
||||
}
|
||||
|
||||
void NetPlayBrowser::OnUpdateListRequested(std::vector<NetPlaySession> sessions)
|
||||
{
|
||||
m_sessions = std::move(sessions);
|
||||
UpdateList();
|
||||
}
|
||||
|
||||
void NetPlayBrowser::accept()
|
||||
{
|
||||
if (m_table_widget->selectedItems().isEmpty())
|
||||
|
|
|
@ -35,6 +35,8 @@ public:
|
|||
void accept() override;
|
||||
signals:
|
||||
void Join();
|
||||
void UpdateStatusRequested(const QString& status);
|
||||
void UpdateListRequested(std::vector<NetPlaySession> sessions);
|
||||
|
||||
private:
|
||||
void CreateWidgets();
|
||||
|
@ -46,6 +48,9 @@ private:
|
|||
|
||||
void OnSelectionChanged();
|
||||
|
||||
void OnUpdateStatusRequested(const QString& status);
|
||||
void OnUpdateListRequested(std::vector<NetPlaySession> sessions);
|
||||
|
||||
void SaveSettings() const;
|
||||
void RestoreSettings();
|
||||
|
||||
|
@ -71,3 +76,5 @@ private:
|
|||
Common::Flag m_refresh_run;
|
||||
Common::Event m_refresh_event;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(std::vector<NetPlaySession>)
|
||||
|
|
Loading…
Reference in New Issue