Fix DebugConsole::initGLTab

The initGLTab used GLPlatform::instance to determine whether OpenGL is
used. It assumed a nullptr would mean no GL. But GLPlatform is a
singleton which does not follow KWin's internal semantics. If there is
no instance it will be created. Thus it's never null.

This caused a heap-buffer-overflow as recorded by build.kde.org in case
one just casts the scene pointer to SceneOpenGL.

With this change this is fixed and inited correctly by verifying through
the EffectsHandler whether opengl is used.
This commit is contained in:
Martin Gräßlin 2016-11-16 08:36:51 +01:00
parent 52cf47ff53
commit 9e4a858285

View file

@ -516,12 +516,12 @@ DebugConsole::~DebugConsole() = default;
void DebugConsole::initGLTab()
{
GLPlatform *gl = GLPlatform::instance();
if (!gl) {
if (!effects || !effects->isOpenGLCompositing()) {
m_ui->noOpenGLLabel->setVisible(true);
m_ui->glInfoScrollArea->setVisible(false);
return;
}
GLPlatform *gl = GLPlatform::instance();
m_ui->noOpenGLLabel->setVisible(false);
m_ui->glInfoScrollArea->setVisible(true);
m_ui->glVendorStringLabel->setText(QString::fromLocal8Bit(gl->glVendorString()));