mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06: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:
@ -25,7 +25,7 @@ namespace NetPlay
|
||||
{
|
||||
class NetPlayClient;
|
||||
class NetPlayServer;
|
||||
}
|
||||
} // namespace NetPlay
|
||||
|
||||
class GameListModel;
|
||||
class InputConfig;
|
||||
@ -98,9 +98,9 @@ public:
|
||||
void DecreaseVolume(int volume);
|
||||
|
||||
// NetPlay
|
||||
NetPlay::NetPlayClient* GetNetPlayClient();
|
||||
std::shared_ptr<NetPlay::NetPlayClient> GetNetPlayClient();
|
||||
void ResetNetPlayClient(NetPlay::NetPlayClient* client = nullptr);
|
||||
NetPlay::NetPlayServer* GetNetPlayServer();
|
||||
std::shared_ptr<NetPlay::NetPlayServer> GetNetPlayServer();
|
||||
void ResetNetPlayServer(NetPlay::NetPlayServer* server = nullptr);
|
||||
|
||||
// Cheats
|
||||
@ -169,8 +169,8 @@ signals:
|
||||
private:
|
||||
bool m_batch = false;
|
||||
bool m_controller_state_needed = false;
|
||||
std::unique_ptr<NetPlay::NetPlayClient> m_client;
|
||||
std::unique_ptr<NetPlay::NetPlayServer> m_server;
|
||||
std::shared_ptr<NetPlay::NetPlayClient> m_client;
|
||||
std::shared_ptr<NetPlay::NetPlayServer> m_server;
|
||||
Settings();
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user