extensions/clientprefs/extension.cpp
changeset 2135 2c56e1550aaa
parent 2131 cbad21fc7626
child 2207 3a97a56ded62
     1.1 --- a/extensions/clientprefs/extension.cpp	Tue Jul 01 06:12:16 2008 +0000
     1.2 +++ b/extensions/clientprefs/extension.cpp	Tue Jul 01 06:13:09 2008 +0000
     1.3 @@ -87,6 +87,8 @@
     1.4  		return false;
     1.5  	}
     1.6  
     1.7 +	dbi->AddDependency(myself, Driver);
     1.8 +
     1.9  	const char *identifier = Driver->GetIdentifier();
    1.10  
    1.11  	if (strcmp(identifier, "sqlite") == 0)
    1.12 @@ -202,6 +204,25 @@
    1.13  	playerhelpers->AddClientListener(&g_CookieManager);
    1.14  }
    1.15  
    1.16 +bool ClientPrefs::QueryInterfaceDrop(SMInterface *pInterface)
    1.17 +{
    1.18 +	if ((void *)pInterface == (void *)(Database->GetDriver()))
    1.19 +	{
    1.20 +		return false;
    1.21 +	}
    1.22 +
    1.23 +	return true;
    1.24 +}
    1.25 +
    1.26 +void ClientPrefs::NotifyInterfaceDrop(SMInterface *pInterface)
    1.27 +{
    1.28 +	if (Database != NULL && (void *)pInterface == (void *)(Database->GetDriver()))
    1.29 +	{
    1.30 +		Database->Close();
    1.31 +		Database = NULL;
    1.32 +	}
    1.33 +}
    1.34 +
    1.35  void ClientPrefs::SDK_OnUnload()
    1.36  {
    1.37  	handlesys->RemoveType(g_CookieType, myself->GetIdentity());
    1.38 @@ -209,7 +230,10 @@
    1.39  
    1.40  	g_CookieManager.Unload();
    1.41  
    1.42 -	Database->Close();
    1.43 +	if (Database != NULL)
    1.44 +	{
    1.45 +		Database->Close();
    1.46 +	}
    1.47  
    1.48  	forwards->ReleaseForward(g_CookieManager.cookieDataLoadedForward);
    1.49