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;
}
}
@ -118,9 +117,12 @@ public:
{
if ( InterlockedDecrement( &registered ) == 0 )
{
pEnumerator->UnregisterEndpointNotificationCallback( this );
pEnumerator->Release();
registered = false;
if (pEnumerator)
{
pEnumerator->UnregisterEndpointNotificationCallback( this );
pEnumerator->Release();
pEnumerator = NULL;
}
}
EnterCriticalSection( &lock );

View File

@ -103,7 +103,6 @@ public:
if ( SUCCEEDED( hr ) )
{
pEnumerator->RegisterEndpointNotificationCallback( this );
registered = true;
}
}
@ -116,9 +115,12 @@ public:
{
if ( InterlockedDecrement( &registered ) == 0 )
{
pEnumerator->UnregisterEndpointNotificationCallback( this );
pEnumerator->Release();
registered = false;
if (pEnumerator)
{
pEnumerator->UnregisterEndpointNotificationCallback( this );
pEnumerator->Release();
pEnumerator = NULL;
}
}
EnterCriticalSection( &lock );