mirror of https://github.com/odrling/Aegisub
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
|
@ -424,15 +424,32 @@ void VideoContext::JumpToFrame(int n) {
|
|||
|
||||
// Not threaded
|
||||
else {
|
||||
// Set frame number
|
||||
frame_n = n;
|
||||
GetFrameAsTexture(n);
|
||||
try {
|
||||
// Set frame number
|
||||
frame_n = n;
|
||||
GetFrameAsTexture(n);
|
||||
|
||||
// Display
|
||||
UpdateDisplays(false);
|
||||
// Display
|
||||
UpdateDisplays(false);
|
||||
|
||||
// Update grid
|
||||
if (!isPlaying && Options.AsBool(_T("Highlight subs in frame"))) grid->Refresh(false);
|
||||
// Update grid
|
||||
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
|
||||
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?
|
||||
if (!IsShownOnScreen()) return;
|
||||
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.");
|
||||
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 New Issue