Fixed a crash on Windows XP and older systems

This commit is contained in:
kode54 2012-08-26 07:44:19 +00:00
parent 7944d44390
commit 4178854b85
2 changed files with 12 additions and 8 deletions

View File

@ -105,7 +105,6 @@ public:
if ( SUCCEEDED( hr ) )
{
pEnumerator->RegisterEndpointNotificationCallback( this );
registered = true;
}
}
@ -117,10 +116,13 @@ public:
void do_unregister( XAudio2_Output * p_instance )
{
if ( InterlockedDecrement( &registered ) == 0 )
{
if (pEnumerator)
{
pEnumerator->UnregisterEndpointNotificationCallback( this );
pEnumerator->Release();
registered = false;
pEnumerator = NULL;
}
}
EnterCriticalSection( &lock );

View File

@ -103,7 +103,6 @@ public:
if ( SUCCEEDED( hr ) )
{
pEnumerator->RegisterEndpointNotificationCallback( this );
registered = true;
}
}
@ -115,10 +114,13 @@ public:
void do_unregister( sound_out_i_xaudio2 * p_instance )
{
if ( InterlockedDecrement( &registered ) == 0 )
{
if (pEnumerator)
{
pEnumerator->UnregisterEndpointNotificationCallback( this );
pEnumerator->Release();
registered = false;
pEnumerator = NULL;
}
}
EnterCriticalSection( &lock );