Nicer shutdown, I think

This commit is contained in:
Garry Newman 2017-08-16 22:11:00 +01:00
parent 5dcfda6c15
commit c5af1f91cf

View File

@ -116,27 +116,6 @@ public void FillInterfaces( BaseSteamworks steamworks, int hpipe, int huser )
public void Dispose()
{
if ( client != null )
{
if ( hPipe != 0 )
{
if ( hUser != 0 )
{
client.ReleaseUser( hPipe, hUser );
hUser = 0;
}
client.BReleaseSteamPipe( hPipe );
hPipe = 0;
}
if ( !client.BShutdownIfAllPipesClosed() )
Console.WriteLine( "BShutdownIfAllPipesClosed returned false" );
client.Dispose();
client = null;
}
if ( user != null )
{
user.Dispose();
@ -187,11 +166,6 @@ public void Dispose()
if ( gameServer != null )
{
//
// Calling this can cause the process to hang
//
//gameServer.LogOff();
gameServer.Dispose();
gameServer = null;
}
@ -232,6 +206,12 @@ public void Dispose()
applist = null;
}
if ( client != null )
{
client.Dispose();
client = null;
}
if ( api != null )
{
if ( isServer )
@ -239,6 +219,16 @@ public void Dispose()
else
api.SteamAPI_Shutdown();
//
// The functions above destroy the pipeline handles
// and all of the classes. Trying to call a steam function
// at this point will result in a crash - because any
// pointers we stored are not invalid.
//
hPipe = 0;
hUser = 0;
api.Dispose();
api = null;
}