Add some error catching in the OpenGL code, this should make most OpenGL-related problems less fatal, though it can still cause funky UI problems I think.
At least the user should get a slightly more useful error message now. Updates #799. Originally committed to SVN as r2998.
This commit is contained in:
parent
da78539ab2
commit
60970e5f29
2 changed files with 43 additions and 8 deletions
|
@ -424,15 +424,32 @@ void VideoContext::JumpToFrame(int n) {
|
||||||
|
|
||||||
// Not threaded
|
// Not threaded
|
||||||
else {
|
else {
|
||||||
// Set frame number
|
try {
|
||||||
frame_n = n;
|
// Set frame number
|
||||||
GetFrameAsTexture(n);
|
frame_n = n;
|
||||||
|
GetFrameAsTexture(n);
|
||||||
|
|
||||||
// Display
|
// Display
|
||||||
UpdateDisplays(false);
|
UpdateDisplays(false);
|
||||||
|
|
||||||
// Update grid
|
// Update grid
|
||||||
if (!isPlaying && Options.AsBool(_T("Highlight subs in frame"))) grid->Refresh(false);
|
if (!isPlaying && Options.AsBool(_T("Highlight subs in frame"))) grid->Refresh(false);
|
||||||
|
}
|
||||||
|
catch (const wxChar *err) {
|
||||||
|
wxLogError(
|
||||||
|
_T("Failed seeking video. The video will be closed because of this.\n")
|
||||||
|
_T("If you get this error regardless of which video file you use, and also if you use dummy video, your OpenGL driver might not work with Aegisub.\n")
|
||||||
|
_T("Error message reported: %s"),
|
||||||
|
err);
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
wxLogError(
|
||||||
|
_T("Failed seeking video. The video will be closed because of this.\n")
|
||||||
|
_T("If you get this error regardless of which video file you use, and also if you use dummy video, your OpenGL driver might not work with Aegisub.\n")
|
||||||
|
_T("No further error message given."));
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,10 @@ void VideoDisplay::ShowCursor(bool show) {
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
// Render
|
// Render
|
||||||
void VideoDisplay::Render() {
|
void VideoDisplay::Render()
|
||||||
|
// Yes it's legal C++ to replace the body of a function with one huge try..catch statement
|
||||||
|
try {
|
||||||
|
|
||||||
// Is shown?
|
// Is shown?
|
||||||
if (!IsShownOnScreen()) return;
|
if (!IsShownOnScreen()) return;
|
||||||
if (!wxIsMainThread()) throw _T("Error: trying to render from non-primary thread");
|
if (!wxIsMainThread()) throw _T("Error: trying to render from non-primary thread");
|
||||||
|
@ -307,6 +310,21 @@ void VideoDisplay::Render() {
|
||||||
//if (glGetError()) throw _T("Error finishing gl operation.");
|
//if (glGetError()) throw _T("Error finishing gl operation.");
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
}
|
}
|
||||||
|
catch (const wxChar *err) {
|
||||||
|
wxLogError(
|
||||||
|
_T("An error occurred trying to render the video frame to screen.\n")
|
||||||
|
_T("If you get this error regardless of which video file you use, and also if you use dummy video, your OpenGL driver might not work with Aegisub.\n")
|
||||||
|
_T("Error message reported: %s"),
|
||||||
|
err);
|
||||||
|
VideoContext::Get()->Reset();
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
wxLogError(
|
||||||
|
_T("An error occurred trying to render the video frame to screen.\n")
|
||||||
|
_T("If you get this error regardless of which video file you use, and also if you use dummy video, your OpenGL driver might not work with Aegisub.\n")
|
||||||
|
_T("No further error message given."));
|
||||||
|
VideoContext::Get()->Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
|
|
Loading…
Reference in a new issue