mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-02 15:17:27 +01:00
Core/Misc: Minor change to make_unique_ptr_with_deleter to make it accept only pointers
(cherry picked from commit 83f4763b25)
This commit is contained in:
@@ -309,7 +309,7 @@ extern int main(int argc, char** argv)
|
||||
|
||||
sRealmList->Initialize(*ioContext, sConfigMgr->GetIntDefault("RealmsStateUpdateDelay", 10));
|
||||
|
||||
auto sRealmListHandle = Trinity::make_unique_ptr_with_deleter(&dummy, [](void*) { sRealmList->Close(); });
|
||||
auto sRealmListHandle = Trinity::make_unique_ptr_with_deleter(sRealmList, [](RealmList* realmList) { realmList->Close(); });
|
||||
|
||||
LoadRealmInfo();
|
||||
|
||||
@@ -323,34 +323,33 @@ extern int main(int argc, char** argv)
|
||||
|
||||
TC_METRIC_EVENT("events", "Worldserver started", "");
|
||||
|
||||
auto sMetricHandle = Trinity::make_unique_ptr_with_deleter(&dummy, [](void*)
|
||||
auto sMetricHandle = Trinity::make_unique_ptr_with_deleter(sMetric, [](Metric* metric)
|
||||
{
|
||||
TC_METRIC_EVENT("events", "Worldserver shutdown", "");
|
||||
sMetric->Unload();
|
||||
metric->Unload();
|
||||
});
|
||||
|
||||
auto scriptReloadMgrHandle = Trinity::make_unique_ptr_with_deleter(sScriptReloadMgr, [](ScriptReloadMgr* mgr) { mgr->Unload(); });
|
||||
|
||||
sScriptMgr->SetScriptLoader(AddScripts);
|
||||
auto sScriptMgrHandle = Trinity::make_unique_ptr_with_deleter(&dummy, [](void*)
|
||||
{
|
||||
sScriptMgr->Unload();
|
||||
sScriptReloadMgr->Unload();
|
||||
});
|
||||
auto sScriptMgrHandle = Trinity::make_unique_ptr_with_deleter(sScriptMgr, [](ScriptMgr* mgr) { mgr->Unload(); });
|
||||
|
||||
// Initialize the World
|
||||
sSecretMgr->Initialize(SECRET_OWNER_WORLDSERVER);
|
||||
if (!sWorld->SetInitialWorldSettings())
|
||||
return 1;
|
||||
|
||||
auto mapManagementHandle = Trinity::make_unique_ptr_with_deleter(&dummy, [](void*)
|
||||
{
|
||||
// unload battleground templates before different singletons destroyed
|
||||
sBattlegroundMgr->DeleteAllBattlegrounds();
|
||||
auto instanceLockMgrHandle = Trinity::make_unique_ptr_with_deleter(&sInstanceLockMgr, [](InstanceLockMgr* mgr) { mgr->Unload(); });
|
||||
|
||||
sMapMgr->UnloadAll(); // unload all grids (including locked in memory)
|
||||
sOutdoorPvPMgr->Die();
|
||||
sTerrainMgr.UnloadAll();
|
||||
sInstanceLockMgr.Unload();
|
||||
});
|
||||
auto terrainMgrHandle = Trinity::make_unique_ptr_with_deleter(&sTerrainMgr, [](TerrainMgr* mgr) { mgr->UnloadAll(); });
|
||||
|
||||
auto outdoorPvpMgrHandle = Trinity::make_unique_ptr_with_deleter(sOutdoorPvPMgr, [](OutdoorPvPMgr* mgr) { mgr->Die(); });
|
||||
|
||||
// unload all grids (including locked in memory)
|
||||
auto mapManagementHandle = Trinity::make_unique_ptr_with_deleter(sMapMgr, [](MapManager* mgr) { mgr->UnloadAll(); });
|
||||
|
||||
// unload battleground templates before different singletons destroyed
|
||||
auto battlegroundMgrHandle = Trinity::make_unique_ptr_with_deleter(sBattlegroundMgr, [](BattlegroundMgr* mgr) { mgr->DeleteAllBattlegrounds(); });
|
||||
|
||||
// Start the Remote Access port (acceptor) if enabled
|
||||
std::unique_ptr<AsyncAcceptor> raAcceptor;
|
||||
@@ -388,12 +387,12 @@ extern int main(int argc, char** argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto sWorldSocketMgrHandle = Trinity::make_unique_ptr_with_deleter(&dummy, [](void*)
|
||||
auto sWorldSocketMgrHandle = Trinity::make_unique_ptr_with_deleter(&sWorldSocketMgr, [](WorldSocketMgr* mgr)
|
||||
{
|
||||
sWorld->KickAll(); // save and kick all players
|
||||
sWorld->UpdateSessions(1); // real players unload required UpdateSessions call
|
||||
|
||||
sWorldSocketMgr.StopNetwork();
|
||||
mgr->StopNetwork();
|
||||
|
||||
///- Clean database before leaving
|
||||
ClearOnlineAccounts();
|
||||
|
||||
Reference in New Issue
Block a user