mirror of https://github.com/odrling/Aegisub
Add some better error catching+reporting in audio loading/unloading. (Don't just crash.)
Originally committed to SVN as r1499.
This commit is contained in:
parent
6bb162523b
commit
720ee8c309
|
@ -810,14 +810,24 @@ void AudioDisplay::SetFile(wxString file) {
|
|||
// Unload
|
||||
if (file.IsEmpty()) {
|
||||
wxLogDebug(_T("AudioDisplay::SetFile: file is empty, just closing audio"));
|
||||
if (player) player->CloseStream();
|
||||
try {
|
||||
if (player) player->CloseStream();
|
||||
}
|
||||
catch (const wxChar *e) {
|
||||
wxLogError(e);
|
||||
}
|
||||
delete provider;
|
||||
delete player;
|
||||
delete spectrumRenderer;
|
||||
provider = NULL;
|
||||
player = NULL;
|
||||
spectrumRenderer = NULL;
|
||||
Reset();
|
||||
try {
|
||||
Reset();
|
||||
}
|
||||
catch (const wxChar *e) {
|
||||
wxLogError(e);
|
||||
}
|
||||
|
||||
loaded = false;
|
||||
temporary = false;
|
||||
|
@ -865,6 +875,11 @@ void AudioDisplay::SetFile(wxString file) {
|
|||
// Update
|
||||
UpdateImage();
|
||||
}
|
||||
catch (const wxChar *e) {
|
||||
if (player) delete player;
|
||||
if (provider) delete provider;
|
||||
wxLogError(e);
|
||||
}
|
||||
catch (wxString &err) {
|
||||
if (player) delete player;
|
||||
if (provider) delete provider;
|
||||
|
|
Loading…
Reference in New Issue