forked from rosebudai/OpenRCT2-Web
Fix #5496: Attempting to log into servers results in crash
Caused by the user not having the required 'official' objects. This was because the network was being closed during a network update. Disposed memory would then be accessed later in the update loop. To fix this, a lock has been added to Close() so that it can be deferred to the end of Update(). This isn't particularly nice, but the whole of network will need redesigning to fix this properly for all potentical scenarios where Close() can be called.
This commit is contained in:
1 parent
430ab2db5c
commit
1e9f9790ae
5 files changed
+44
-11
No files matched your search
@@ -717,18 +717,28 @@ bool IsObjectCustom(const ObjectRepositoryItem * object)
|
||||
|
||||
extern "C"
|
||||
{
|
||||
rct_object_entry * object_list_find(rct_object_entry * entry)
|
||||
const rct_object_entry * object_list_find(rct_object_entry * entry)
|
||||
{
|
||||
IObjectRepository * objRepo = GetObjectRepository();
|
||||
const ObjectRepositoryItem * item = objRepo->FindObject(entry);
|
||||
return (rct_object_entry *)&item->ObjectEntry;
|
||||
const rct_object_entry * result = nullptr;
|
||||
auto objRepo = GetObjectRepository();
|
||||
auto item = objRepo->FindObject(entry);
|
||||
if (item != nullptr)
|
||||
{
|
||||
result = &item->ObjectEntry;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
rct_object_entry * object_list_find_by_name(const char * name)
|
||||
const rct_object_entry * object_list_find_by_name(const char * name)
|
||||
{
|
||||
IObjectRepository * objRepo = GetObjectRepository();
|
||||
const ObjectRepositoryItem * item = objRepo->FindObject(name);
|
||||
return (rct_object_entry *)&item->ObjectEntry;
|
||||
const rct_object_entry * result = nullptr;
|
||||
auto objRepo = GetObjectRepository();
|
||||
auto item = objRepo->FindObject(name);
|
||||
if (item != nullptr)
|
||||
{
|
||||
result = &item->ObjectEntry;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void object_list_load()
|
||||
|
||||
Reference in new issue
Block a user