Prevent UI thread deadlocking on Dispose()'ing rcheevos stuff

This commit is contained in:
CasualPokePlayer 2023-05-02 17:18:31 -07:00
parent b9a983f1fe
commit 8ef1d93891
2 changed files with 8 additions and 7 deletions

View File

@ -179,6 +179,14 @@ namespace BizHawk.Client.EmuHawk
return shouldRemove;
});
}
// typically I'd rather do this Dispose()
// but the Wait() semantics mean we can't do that on the UI thread
foreach (var request in _activeHttpRequests)
{
if (request is ImageRequest) continue; // THIS IS BAD, I KNOW (but don't want the user to wait for useless ImageRequests to finish)
request.Dispose(); // implicitly waits for the request to finish or timeout
}
}
private static async Task<byte[]> HttpGet(string url)

View File

@ -226,13 +226,6 @@ namespace BizHawk.Client.EmuHawk
_isActive = false;
_httpThread.Join();
// the http thread is dead, so we can safely use _activeHttpRequests
foreach (var request in _activeHttpRequests)
{
if (request is ImageRequest) continue; // THIS IS BAD, I KNOW
request.Dispose(); // implicitly waits for the request to finish or timeout
}
_lib.rc_runtime_destroy(ref _runtime);
Stop();
_gameInfoForm.Dispose();