Merge pull request #35 from momo5502/bugfix/steam-crash

Stabilize steamproxy cleanup
This commit is contained in:
Maurice Heumann 2022-10-01 18:56:35 +02:00 committed by GitHub
commit df7f033e41

View File

@ -93,6 +93,8 @@ namespace steam_proxy
client_engine = nullptr;
client_user = nullptr;
client_utils = nullptr;
client_friends = nullptr;
client_ugc = nullptr;
steam_pipe = nullptr;
global_user = nullptr;
@ -100,9 +102,7 @@ namespace steam_proxy
steam_client_module = utils::nt::library{nullptr};
}
void clean_up_on_error()
{
scheduler::schedule([]
bool perform_cleanup_if_needed()
{
if (steam_client_module
&& steam_pipe
@ -112,12 +112,24 @@ namespace steam_proxy
&& steam_client_module.invoke<bool>("Steam_BLoggedOn", global_user, steam_pipe)
)
{
return scheduler::cond_continue;
return false;
}
do_cleanup();
return true;
}
void clean_up_on_error()
{
scheduler::schedule([]
{
if (perform_cleanup_if_needed())
{
return scheduler::cond_end;
});
}
return scheduler::cond_continue;
}, scheduler::main);
}
ownership_state start_mod_unsafe(const std::string& title, size_t app_id)