fix crash on ALSA SW fallback
This commit is contained in:
@@ -43,15 +43,14 @@ CString LoadALSA()
|
|||||||
return "";
|
return "";
|
||||||
error:
|
error:
|
||||||
UnloadALSA();
|
UnloadALSA();
|
||||||
if( Handle )
|
|
||||||
dlclose( Handle );
|
|
||||||
Handle = NULL;
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnloadALSA()
|
void UnloadALSA()
|
||||||
{
|
{
|
||||||
|
if( Handle )
|
||||||
dlclose( Handle );
|
dlclose( Handle );
|
||||||
|
Handle = NULL;
|
||||||
#define FUNC(ret, name, proto) d##name = NULL;
|
#define FUNC(ret, name, proto) d##name = NULL;
|
||||||
#include "ALSA9Functions.h"
|
#include "ALSA9Functions.h"
|
||||||
#undef FUNC
|
#undef FUNC
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ RageSound_ALSA9::RageSound_ALSA9()
|
|||||||
CString err = LoadALSA();
|
CString err = LoadALSA();
|
||||||
if( err != "" )
|
if( err != "" )
|
||||||
RageException::ThrowNonfatal("Driver unusable: %s", err.c_str());
|
RageException::ThrowNonfatal("Driver unusable: %s", err.c_str());
|
||||||
|
try {
|
||||||
shutdown = false;
|
shutdown = false;
|
||||||
|
|
||||||
/* Create a bunch of streams and put them into the stream pool. */
|
/* Create a bunch of streams and put them into the stream pool. */
|
||||||
@@ -249,6 +249,10 @@ RageSound_ALSA9::RageSound_ALSA9()
|
|||||||
|
|
||||||
MixingThread.SetName( "RageSound_ALSA9" );
|
MixingThread.SetName( "RageSound_ALSA9" );
|
||||||
MixingThread.Create( MixerThread_start, this );
|
MixingThread.Create( MixerThread_start, this );
|
||||||
|
} catch(...) {
|
||||||
|
UnloadALSA();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RageSound_ALSA9::~RageSound_ALSA9()
|
RageSound_ALSA9::~RageSound_ALSA9()
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ RageSound_ALSA9_Software::RageSound_ALSA9_Software()
|
|||||||
CString err = LoadALSA();
|
CString err = LoadALSA();
|
||||||
if( err != "" )
|
if( err != "" )
|
||||||
RageException::ThrowNonfatal("Driver unusable: %s", err.c_str());
|
RageException::ThrowNonfatal("Driver unusable: %s", err.c_str());
|
||||||
|
try {
|
||||||
shutdown = false;
|
shutdown = false;
|
||||||
|
|
||||||
max_writeahead = safe_writeahead;
|
max_writeahead = safe_writeahead;
|
||||||
@@ -198,6 +198,11 @@ RageSound_ALSA9_Software::RageSound_ALSA9_Software()
|
|||||||
|
|
||||||
MixingThread.SetName( "RageSound_ALSA9_Software" );
|
MixingThread.SetName( "RageSound_ALSA9_Software" );
|
||||||
MixingThread.Create( MixerThread_start, this );
|
MixingThread.Create( MixerThread_start, this );
|
||||||
|
} catch(...) {
|
||||||
|
UnloadALSA();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RageSound_ALSA9_Software::~RageSound_ALSA9_Software()
|
RageSound_ALSA9_Software::~RageSound_ALSA9_Software()
|
||||||
|
|||||||
Reference in New Issue
Block a user