2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

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;
}
system->GetRoomNetwork().Shutdown();
#ifdef __linux__
::close(sig_interrupt_fds[0]);
::close(sig_interrupt_fds[1]);
@ -3831,6 +3829,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
render_window->close();
multiplayer_state->Close();
system->GetRoomNetwork().Shutdown();
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 (auto member = room_network.GetRoomMember().lock()) {
member->Unbind(state_callback_handle);
@ -71,9 +73,6 @@ MultiplayerState::~MultiplayerState() {
member->Unbind(error_callback_handle);
}
}
}
void MultiplayerState::Close() {
if (host_room) {
host_room->close();
}