yuzu: Fix crash on shutdown

Previously, accessing the room_network when it was already freed would crash the emulator on shutdown.

Co-Authored-By: Narr the Reg <5944268+german77@users.noreply.github.com>
This commit is contained in:
FearlessTobi 2022-08-03 19:45:13 +02:00
parent 5cd95fa949
commit 72ff5cd445
2 changed files with 4 additions and 6 deletions

View File

@ -492,8 +492,6 @@ GMainWindow::~GMainWindow() {
delete render_window; delete render_window;
} }
system->GetRoomNetwork().Shutdown();
#ifdef __linux__ #ifdef __linux__
::close(sig_interrupt_fds[0]); ::close(sig_interrupt_fds[0]);
::close(sig_interrupt_fds[1]); ::close(sig_interrupt_fds[1]);
@ -3831,6 +3829,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
render_window->close(); render_window->close();
multiplayer_state->Close(); multiplayer_state->Close();
system->GetRoomNetwork().Shutdown();
QWidget::closeEvent(event); QWidget::closeEvent(event);
} }

View File

@ -59,7 +59,9 @@ MultiplayerState::MultiplayerState(QWidget* parent, QStandardItemModel* game_lis
}); });
} }
MultiplayerState::~MultiplayerState() { MultiplayerState::~MultiplayerState() = default;
void MultiplayerState::Close() {
if (state_callback_handle) { if (state_callback_handle) {
if (auto member = room_network.GetRoomMember().lock()) { if (auto member = room_network.GetRoomMember().lock()) {
member->Unbind(state_callback_handle); member->Unbind(state_callback_handle);
@ -71,9 +73,6 @@ MultiplayerState::~MultiplayerState() {
member->Unbind(error_callback_handle); member->Unbind(error_callback_handle);
} }
} }
}
void MultiplayerState::Close() {
if (host_room) { if (host_room) {
host_room->close(); host_room->close();
} }