Skip to content

Commit

Permalink
Prevent segfault when OpenGL is set on remote X11 session.
Browse files Browse the repository at this point in the history
OpenGL fails on a remote session. GUI will revert to QT painter
when running on a remote X11 session.
  • Loading branch information
bennettpeter committed Feb 14, 2017
1 parent af199e7 commit 3db436f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mythtv/libs/libmythui/mythrender_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ OpenGLLocker::~OpenGLLocker()
MythRenderOpenGL* MythRenderOpenGL::Create(const QString &painter,
QPaintDevice* device)
{
QString display = getenv("DISPLAY");
// Determine if we are running a remote X11 session
// DISPLAY=:x or DISPLAY=unix:x are local
// DISPLAY=hostname:x is remote
// x can be numbers n or n.n
// Anything else including DISPLAY not set is assumed local,
// in that case we are probably not running under X11
if (!display.isEmpty()
&& !display.startsWith(":")
&& !display.startsWith("unix:")
&& display.contains(':'))
{
LOG(VB_GENERAL, LOG_WARNING, LOC + "OpenGL is disabled for Remote X Session");
return 0;
}
#ifdef USE_OPENGL_QT5
MythRenderFormat format = QSurfaceFormat::defaultFormat();
format.setDepthBufferSize(0);
Expand Down

0 comments on commit 3db436f

Please sign in to comment.