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
|
// Unload
|
||||||
if (file.IsEmpty()) {
|
if (file.IsEmpty()) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetFile: file is empty, just closing audio"));
|
wxLogDebug(_T("AudioDisplay::SetFile: file is empty, just closing audio"));
|
||||||
|
try {
|
||||||
if (player) player->CloseStream();
|
if (player) player->CloseStream();
|
||||||
|
}
|
||||||
|
catch (const wxChar *e) {
|
||||||
|
wxLogError(e);
|
||||||
|
}
|
||||||
delete provider;
|
delete provider;
|
||||||
delete player;
|
delete player;
|
||||||
delete spectrumRenderer;
|
delete spectrumRenderer;
|
||||||
provider = NULL;
|
provider = NULL;
|
||||||
player = NULL;
|
player = NULL;
|
||||||
spectrumRenderer = NULL;
|
spectrumRenderer = NULL;
|
||||||
|
try {
|
||||||
Reset();
|
Reset();
|
||||||
|
}
|
||||||
|
catch (const wxChar *e) {
|
||||||
|
wxLogError(e);
|
||||||
|
}
|
||||||
|
|
||||||
loaded = false;
|
loaded = false;
|
||||||
temporary = false;
|
temporary = false;
|
||||||
|
@ -865,6 +875,11 @@ void AudioDisplay::SetFile(wxString file) {
|
||||||
// Update
|
// Update
|
||||||
UpdateImage();
|
UpdateImage();
|
||||||
}
|
}
|
||||||
|
catch (const wxChar *e) {
|
||||||
|
if (player) delete player;
|
||||||
|
if (provider) delete provider;
|
||||||
|
wxLogError(e);
|
||||||
|
}
|
||||||
catch (wxString &err) {
|
catch (wxString &err) {
|
||||||
if (player) delete player;
|
if (player) delete player;
|
||||||
if (provider) delete provider;
|
if (provider) delete provider;
|
||||||
|
|
Loading…
Reference in New Issue