1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 12:03:07 +01:00

Close #19032: Use RAII for crash registration when loading park file (#19100)

Co-authored-by: Christopher G. Dolan <cgdolan@users.noreply.github.com>
This commit is contained in:
Chris Dolan
2023-01-10 13:27:40 -07:00
committed by GitHub
parent 97c6b8c5c9
commit 16729c2b61

View File

@@ -559,16 +559,19 @@ namespace OpenRCT2
{
log_verbose("Context::LoadParkFromFile(%s)", path.c_str());
// Register the file for crash upload if it asserts while loading.
crash_register_additional_file("load_park", path);
// Deregister park file in case it was processed without hitting an assert.
struct foo
struct CrashAdditionalFileRegistration
{
~foo()
CrashAdditionalFileRegistration(const std::string& path)
{
// Register the file for crash upload if it asserts while loading.
crash_register_additional_file("load_park", path);
}
~CrashAdditionalFileRegistration()
{
// Deregister park file in case it was processed without hitting an assert.
crash_unregister_additional_file("load_park");
}
} f;
} crash_additional_file_registration(path);
try
{