core/AdminCache.cpp
changeset 520 7676d61cde2d
parent 514 4c02b38c26ed
child 583 9fab8343cc15
     1.1 --- a/core/AdminCache.cpp	Sat Feb 17 17:35:09 2007 +0000
     1.2 +++ b/core/AdminCache.cpp	Sat Feb 17 19:03:18 2007 +0000
     1.3 @@ -34,10 +34,12 @@
     1.4  	m_FirstGroup = -1;
     1.5  	m_pAuthTables = sm_trie_create();
     1.6  	m_InvalidatingAdmins = false;
     1.7 +	m_destroying = false;
     1.8  }
     1.9  
    1.10  AdminCache::~AdminCache()
    1.11  {
    1.12 +	m_destroying = true;
    1.13  	DumpAdminCache(AdminCache_Overrides, false);
    1.14  	DumpAdminCache(AdminCache_Groups, false);
    1.15  
    1.16 @@ -549,7 +551,7 @@
    1.17  		return false;
    1.18  	}
    1.19  
    1.20 -	if (!m_InvalidatingAdmins)
    1.21 +	if (!m_InvalidatingAdmins && !m_destroying)
    1.22  	{
    1.23  		g_Players.ClearAdminId(id);
    1.24  	}
    1.25 @@ -749,7 +751,10 @@
    1.26  void AdminCache::InvalidateAdminCache(bool unlink_admins)
    1.27  {
    1.28  	m_InvalidatingAdmins = true;
    1.29 -	g_Players.ClearAllAdmins();
    1.30 +	if (!m_destroying)
    1.31 +	{
    1.32 +		g_Players.ClearAllAdmins();
    1.33 +	}
    1.34  	/* Wipe the identity cache first */
    1.35  	List<AuthMethod>::iterator iter;
    1.36  	for (iter=m_AuthMethods.begin();
    1.37 @@ -783,7 +788,7 @@
    1.38  	{
    1.39  		DumpCommandOverrideCache(Override_Command);
    1.40  		DumpCommandOverrideCache(Override_CommandGroup);
    1.41 -		if (rebuild)
    1.42 +		if (rebuild && !m_destroying)
    1.43  		{
    1.44  			for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
    1.45  			{
    1.46 @@ -797,7 +802,7 @@
    1.47  		if (part == AdminCache_Groups)
    1.48  		{
    1.49  			InvalidateGroupCache();
    1.50 -			if (rebuild)
    1.51 +			if (rebuild && !m_destroying)
    1.52  			{
    1.53  				for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
    1.54  				{
    1.55 @@ -809,7 +814,7 @@
    1.56  			}
    1.57  		}
    1.58  		InvalidateAdminCache(true);
    1.59 -		if (rebuild)
    1.60 +		if (rebuild && !m_destroying)
    1.61  		{
    1.62  			for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
    1.63  			{