fix: bugs in private instances causing master crashes (#1986)

* fix: bugs in private instances causing master crashes

tested that creating a private instance and shutting down the server no longer crashes master

* Update InstanceManager.cpp
This commit is contained in:
David Markowitz
2026-06-08 21:22:04 -07:00
committed by GitHub
parent 045e097b13
commit a307f0601a
3 changed files with 11 additions and 7 deletions

View File

@@ -665,7 +665,7 @@ void HandlePacket(Packet* packet) {
inStream.Read(theirInstanceID);
const auto& instance =
Game::im->FindInstance(theirZoneID, theirInstanceID);
Game::im->FindInstanceWithPrivate(theirZoneID, theirInstanceID);
if (instance) {
instance->AddPlayer(Player());
} else {
@@ -762,7 +762,7 @@ void HandlePacket(Packet* packet) {
LOG("Got world ready %i %i", zoneID, instanceID);
const auto& instance = Game::im->FindInstance(zoneID, instanceID);
const auto& instance = Game::im->FindInstanceWithPrivate(zoneID, instanceID);
if (instance == nullptr) {
LOG("Failed to find zone to ready");
@@ -858,13 +858,11 @@ int ShutdownSequence(int32_t signal) {
}
// A server might not be finished spinning up yet, remove all of those here.
// prune the unready ones before looping over all of them
Game::im->PruneUnreadyInstances();
for (const auto& instance : Game::im->GetInstances()) {
if (!instance) continue;
if (!instance->GetIsReady()) {
Game::im->RemoveInstance(instance);
}
instance->SetIsShuttingDown(true);
}