From ac0ef8099975b62045522fe183558fc4ce83fd58 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 23 Jun 2020 22:09:36 +0200 Subject: [PATCH] Try to fix crash on calling glGetString() without a GL context. --- src/wx/system_information_dialog.cc | 27 +++++++++++---------------- 1 file 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 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 viewer = weak_viewer.lock (); + GLVideoView const * gl = viewer ? dynamic_cast(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(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 (); -- 2.30.2