mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-16 12:58:33 +02:00
Fix more segfaults on NetPlay quit
Basically everything here was race conditions in Qt callbacks, so I changed the client/server instances to std::shared_ptr and added null checks. It checks that the object exists in the callback, and the shared_ptr ensures it doesn't get destroyed until we're done with it. MD5 check would also cause a segfault if you quit without cancelling it first, which was pretty silly.
This commit is contained in:
@ -668,7 +668,7 @@ bool MainWindow::RequestStop()
|
||||
const Core::State state = Core::GetState();
|
||||
|
||||
// Only pause the game, if NetPlay is not running
|
||||
bool pause = Settings::Instance().GetNetPlayClient() == nullptr;
|
||||
bool pause = !Settings::Instance().GetNetPlayClient();
|
||||
|
||||
if (pause)
|
||||
Core::SetState(Core::State::Paused);
|
||||
@ -1071,7 +1071,7 @@ bool MainWindow::NetPlayJoin()
|
||||
|
||||
std::string host_ip;
|
||||
u16 host_port;
|
||||
if (Settings::Instance().GetNetPlayServer() != nullptr)
|
||||
if (Settings::Instance().GetNetPlayServer())
|
||||
{
|
||||
host_ip = "127.0.0.1";
|
||||
host_port = Settings::Instance().GetNetPlayServer()->GetPort();
|
||||
|
Reference in New Issue
Block a user