summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-09-08 11:46:13 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-09-08 13:04:02 +0100
commit56900a441de1d4cc896ad1e36a44622ed1598fad (patch)
treeae176203c003dce23d188dbd198359da802d728f /vcl
parent2456cf8306be22e32130e789ab939c059e5e79e5 (diff)
tdf#94006 - fix OpenGLContext mis-use in several places.
gltf rendering, OpenGL canvas, GL transitions & GL capable (charts) Avoid GLX operations on un-initialized contexts. Change-Id: I7f523640f66ab656896181e5c865879234f6640e
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx11
-rw-r--r--vcl/source/window/openglwin.cxx7
2 files changed, 11 insertions, 7 deletions
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index d070e3fb3b6b..432241f03817 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -1362,11 +1362,14 @@ void OpenGLContext::makeCurrent()
TempErrorHandler aErrorHandler(m_aGLWin.dpy, unxErrorHandler);
#endif
- GLXDrawable nDrawable = mbPixmap ? m_aGLWin.glPix : m_aGLWin.win;
- if (!glXMakeCurrent( m_aGLWin.dpy, nDrawable, m_aGLWin.ctx ))
+ if (m_aGLWin.dpy)
{
- SAL_WARN("vcl.opengl", "OpenGLContext::makeCurrent failed on drawable " << nDrawable << " pixmap? " << mbPixmap);
- return;
+ GLXDrawable nDrawable = mbPixmap ? m_aGLWin.glPix : m_aGLWin.win;
+ if (!glXMakeCurrent( m_aGLWin.dpy, nDrawable, m_aGLWin.ctx ))
+ {
+ SAL_WARN("vcl.opengl", "OpenGLContext::makeCurrent failed on drawable " << nDrawable << " pixmap? " << mbPixmap);
+ return;
+ }
}
#endif
diff --git a/vcl/source/window/openglwin.cxx b/vcl/source/window/openglwin.cxx
index 46628c6d7929..e07937538d7c 100644
--- a/vcl/source/window/openglwin.cxx
+++ b/vcl/source/window/openglwin.cxx
@@ -17,18 +17,19 @@ class OpenGLWindowImpl
public:
explicit OpenGLWindowImpl(vcl::Window* pWindow);
~OpenGLWindowImpl() { mxChildWindow.disposeAndClear(); }
- OpenGLContext& getContext() { return maContext;}
+ OpenGLContext& getContext() { return *mxContext.get(); }
private:
- OpenGLContext maContext;
+ rtl::Reference<OpenGLContext> mxContext;
VclPtr<SystemChildWindow> mxChildWindow;
};
OpenGLWindowImpl::OpenGLWindowImpl(vcl::Window* pWindow)
+ : mxContext(OpenGLContext::Create())
{
SystemWindowData aData = OpenGLContext::generateWinData(pWindow, false);
mxChildWindow.reset(VclPtr<SystemChildWindow>::Create(pWindow, 0, &aData));
mxChildWindow->Show();
- maContext.init(mxChildWindow.get());
+ mxContext->init(mxChildWindow.get());
pWindow->SetMouseTransparent(false);
}