Don't crash if exiting on panic
This commit is contained in:
parent
14a0862342
commit
a30c8f0890
3 changed files with 14 additions and 0 deletions
|
@ -283,6 +283,11 @@ void audioapi_driver_init() throw();
|
|||
*/
|
||||
void audioapi_driver_quit() throw();
|
||||
|
||||
/**
|
||||
* Panic notification.
|
||||
*/
|
||||
void audioapi_panicing() throw();
|
||||
|
||||
/**
|
||||
* Enable or disable sound.
|
||||
*
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
bool paniced = false;
|
||||
const unsigned voicep_bufsize = 65536;
|
||||
const unsigned voicer_bufsize = 65536;
|
||||
const unsigned music_bufsize = 8192;
|
||||
|
@ -506,6 +507,8 @@ void audioapi_vumeter::operator()(float* asamples, size_t count, bool stereo, do
|
|||
|
||||
void audioapi_vumeter::update_vu()
|
||||
{
|
||||
if(paniced)
|
||||
return;
|
||||
if(!samples) {
|
||||
vu = -999.0;
|
||||
accumulator = 0;
|
||||
|
@ -522,6 +525,11 @@ void audioapi_vumeter::update_vu()
|
|||
CORE().dispatch->vu_change();
|
||||
}
|
||||
|
||||
void audioapi_panicing() throw()
|
||||
{
|
||||
paniced = true;
|
||||
}
|
||||
|
||||
//VU values.
|
||||
audioapi_vumeter audioapi_vu_mleft;
|
||||
audioapi_vumeter audioapi_vu_mright;
|
||||
|
|
|
@ -228,6 +228,7 @@ void platform::fatal_error() throw()
|
|||
system_log << "-----------------------------------------------------------------------" << std::endl;
|
||||
system_log.close();
|
||||
graphics_driver_fatal_error();
|
||||
audioapi_panicing(); //Don't call update VU, as that crashes.
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue