mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 15:55:31 +01:00
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 "Core/ConfigManager.h"
|
||||||
|
|
||||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||||
#include "DolphinQt/QtUtils/RunOnObject.h"
|
|
||||||
#include "DolphinQt/Settings.h"
|
#include "DolphinQt/Settings.h"
|
||||||
|
|
||||||
NetPlayBrowser::NetPlayBrowser(QWidget* parent) : QDialog(parent)
|
NetPlayBrowser::NetPlayBrowser(QWidget* parent) : QDialog(parent)
|
||||||
@ -148,6 +147,11 @@ void NetPlayBrowser::ConnectWidgets()
|
|||||||
connect(m_table_widget, &QTableWidget::itemSelectionChanged, this,
|
connect(m_table_widget, &QTableWidget::itemSelectionChanged, this,
|
||||||
&NetPlayBrowser::OnSelectionChanged);
|
&NetPlayBrowser::OnSelectionChanged);
|
||||||
connect(m_table_widget, &QTableWidget::itemDoubleClicked, this, &NetPlayBrowser::accept);
|
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()
|
void NetPlayBrowser::Refresh()
|
||||||
@ -191,10 +195,7 @@ void NetPlayBrowser::RefreshLoop()
|
|||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
RunOnObject(this, [this] {
|
emit UpdateStatusRequested(tr("Refreshing..."));
|
||||||
m_status_label->setText(tr("Refreshing..."));
|
|
||||||
return nullptr;
|
|
||||||
});
|
|
||||||
|
|
||||||
NetPlayIndex client;
|
NetPlayIndex client;
|
||||||
|
|
||||||
@ -202,19 +203,12 @@ void NetPlayBrowser::RefreshLoop()
|
|||||||
|
|
||||||
if (entries)
|
if (entries)
|
||||||
{
|
{
|
||||||
RunOnObject(this, [this, &entries] {
|
emit UpdateListRequested(std::move(*entries));
|
||||||
m_sessions = *entries;
|
|
||||||
UpdateList();
|
|
||||||
return nullptr;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RunOnObject(this, [this, &client] {
|
emit UpdateStatusRequested(tr("Error obtaining session list: %1")
|
||||||
m_status_label->setText(tr("Error obtaining session list: %1")
|
|
||||||
.arg(QString::fromStdString(client.GetLastError())));
|
.arg(QString::fromStdString(client.GetLastError())));
|
||||||
return nullptr;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -277,6 +271,17 @@ void NetPlayBrowser::OnSelectionChanged()
|
|||||||
->setEnabled(!m_table_widget->selectedItems().isEmpty());
|
->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()
|
void NetPlayBrowser::accept()
|
||||||
{
|
{
|
||||||
if (m_table_widget->selectedItems().isEmpty())
|
if (m_table_widget->selectedItems().isEmpty())
|
||||||
|
@ -35,6 +35,8 @@ public:
|
|||||||
void accept() override;
|
void accept() override;
|
||||||
signals:
|
signals:
|
||||||
void Join();
|
void Join();
|
||||||
|
void UpdateStatusRequested(const QString& status);
|
||||||
|
void UpdateListRequested(std::vector<NetPlaySession> sessions);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateWidgets();
|
void CreateWidgets();
|
||||||
@ -46,6 +48,9 @@ private:
|
|||||||
|
|
||||||
void OnSelectionChanged();
|
void OnSelectionChanged();
|
||||||
|
|
||||||
|
void OnUpdateStatusRequested(const QString& status);
|
||||||
|
void OnUpdateListRequested(std::vector<NetPlaySession> sessions);
|
||||||
|
|
||||||
void SaveSettings() const;
|
void SaveSettings() const;
|
||||||
void RestoreSettings();
|
void RestoreSettings();
|
||||||
|
|
||||||
@ -71,3 +76,5 @@ private:
|
|||||||
Common::Flag m_refresh_run;
|
Common::Flag m_refresh_run;
|
||||||
Common::Event m_refresh_event;
|
Common::Event m_refresh_event;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(std::vector<NetPlaySession>)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user