mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-23 20:38:07 +01:00
Don't create new client instance when unregistering callbacks.
This commit is contained in:
parent
0082242a6f
commit
a4ef72cb3c
1 changed files with 9 additions and 7 deletions
16
dll/dll.cpp
16
dll/dll.cpp
|
@ -129,23 +129,23 @@ STEAMAPI_API ISteamClient *g_pSteamClientGameServer;
|
||||||
ISteamClient *g_pSteamClientGameServer;
|
ISteamClient *g_pSteamClientGameServer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static Steam_Client *client;
|
static Steam_Client *steamclient_instance;
|
||||||
Steam_Client *get_steam_client()
|
Steam_Client *get_steam_client()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (!client) {
|
if (!steamclient_instance) {
|
||||||
client = new Steam_Client();
|
steamclient_instance = new Steam_Client();
|
||||||
}
|
}
|
||||||
|
|
||||||
return client;
|
return steamclient_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroy_client()
|
void destroy_client()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
if (client) {
|
if (steamclient_instance) {
|
||||||
delete client;
|
delete steamclient_instance;
|
||||||
client = NULL;
|
steamclient_instance = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,6 +416,7 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_UnregisterCallback( class CCallbackBase *p
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("SteamAPI_UnregisterCallback %p\n", pCallback);
|
PRINT_DEBUG("SteamAPI_UnregisterCallback %p\n", pCallback);
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
|
if (!steamclient_instance) return;
|
||||||
get_steam_client()->UnregisterCallback(pCallback);
|
get_steam_client()->UnregisterCallback(pCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,6 +436,7 @@ STEAMAPI_API void S_CALLTYPE SteamAPI_UnregisterCallResult( class CCallbackBase
|
||||||
if (!hAPICall)
|
if (!hAPICall)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!steamclient_instance) return;
|
||||||
get_steam_client()->UnregisterCallResult(pCallback, hAPICall);
|
get_steam_client()->UnregisterCallResult(pCallback, hAPICall);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue