mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-24 13:45:37 +03:00
Nicer shutdown, I think
This commit is contained in:
parent
5dcfda6c15
commit
c5af1f91cf
@ -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();
|
||||
@ -186,12 +165,7 @@ 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user