summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-06-23 22:09:36 +0200
committerCarl Hetherington <cth@carlh.net>2020-06-23 22:09:36 +0200
commitac0ef8099975b62045522fe183558fc4ce83fd58 (patch)
tree8b308d815f76157f3dcca843ba13a4d145913ca2
parent9e5d71ceede8bcafc1e401814b38e2fc8b17e9c7 (diff)
Try to fix crash on calling glGetString() without a GL context.
-rw-r--r--src/wx/system_information_dialog.cc27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/wx/system_information_dialog.cc b/src/wx/system_information_dialog.cc
index 592e7c0ef..2d9044f6b 100644
--- a/src/wx/system_information_dialog.cc
+++ b/src/wx/system_information_dialog.cc
@@ -38,27 +38,22 @@ using boost::shared_ptr;
SystemInformationDialog::SystemInformationDialog (wxWindow* parent, weak_ptr<FilmViewer> weak_viewer)
: TableDialog (parent, _("System information"), 2, 1, false)
{
- add (_("OpenGL version"), true);
- char const * v = (char const *) glGetString (GL_VERSION);
- if (v) {
- add (std_to_wx(v), false);
- } else {
- add (_("unknown (OpenGL not enabled in DCP-o-matic)"), false);
- }
-
-
- add (_("vsync"), true);
shared_ptr<FilmViewer> viewer = weak_viewer.lock ();
+ GLVideoView const * gl = viewer ? dynamic_cast<GLVideoView const *>(viewer->video_view()) : 0;
- if (!viewer) {
- add (_("unknown"), false);
+ if (!gl) {
+ add (_("OpenGL version"), true);
+ add (_("unknown (OpenGL not enabled in DCP-o-matic)"), false);
} else {
- GLVideoView const * gl = dynamic_cast<GLVideoView const *>(viewer->video_view());
- if (!gl) {
- add (_("unknown"), false);
+ add (_("OpenGL version"), true);
+ char const * v = (char const *) glGetString (GL_VERSION);
+ if (v) {
+ add (std_to_wx(v), false);
} else {
- add (gl->vsync_enabled() ? _("enabled") : _("not enabled"), false);
+ add (_("unknown"), false);
}
+ add (_("vsync"), true);
+ add (gl->vsync_enabled() ? _("enabled") : _("not enabled"), false);
}
layout ();