diff options
-rw-r--r-- | chart2/source/view/charttypes/GL3DBarChart.cxx | 14 | ||||
-rw-r--r-- | chart2/source/view/inc/GL3DBarChart.hxx | 2 | ||||
-rw-r--r-- | include/vcl/openglwin.hxx | 2 | ||||
-rw-r--r-- | vcl/source/window/openglwin.cxx | 2 |
4 files changed, 18 insertions, 2 deletions
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index a3a88584adfb..5b0c764601bb 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -29,7 +29,8 @@ GL3DBarChart::GL3DBarChart( mxChartType(xChartType), mpRenderer(new opengl3D::OpenGL3DRenderer()), mrWindow(rWindow), - mpCamera(NULL) + mpCamera(NULL), + mbValidContext(true) { Size aSize = mrWindow.GetSizePixel(); mpRenderer->SetSize(aSize); @@ -39,7 +40,8 @@ GL3DBarChart::GL3DBarChart( GL3DBarChart::~GL3DBarChart() { - mrWindow.setRenderer(NULL); + if(mbValidContext) + mrWindow.setRenderer(NULL); } namespace { @@ -186,6 +188,9 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer void GL3DBarChart::render() { + if(!mbValidContext) + return; + mrWindow.getContext()->makeCurrent(); Size aSize = mrWindow.GetSizePixel(); mpRenderer->SetSize(aSize); @@ -238,6 +243,11 @@ void GL3DBarChart::clickedAt(const Point& rPos) mpCamera->zoom(nId); } +void GL3DBarChart::contextDestroyed() +{ + mbValidContext = false; +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx index cc252cf4e014..674daf6e0d09 100644 --- a/chart2/source/view/inc/GL3DBarChart.hxx +++ b/chart2/source/view/inc/GL3DBarChart.hxx @@ -47,6 +47,7 @@ public: virtual void update() SAL_OVERRIDE; virtual void clickedAt(const Point& rPos) SAL_OVERRIDE; + virtual void contextDestroyed() SAL_OVERRIDE; private: css::uno::Reference<css::chart2::XChartType> mxChartType; @@ -56,6 +57,7 @@ private: OpenGLWindow& mrWindow; opengl3D::Camera* mpCamera; + bool mbValidContext; }; } diff --git a/include/vcl/openglwin.hxx b/include/vcl/openglwin.hxx index e9b823e6a15a..8e34d0579521 100644 --- a/include/vcl/openglwin.hxx +++ b/include/vcl/openglwin.hxx @@ -24,6 +24,8 @@ public: virtual ~IRenderer() {} virtual void update() = 0; virtual void clickedAt(const Point& rPos) = 0; + + virtual void contextDestroyed() = 0; }; // pImpl Pattern to avoid linking against OpenGL libs when using the class without the context diff --git a/vcl/source/window/openglwin.cxx b/vcl/source/window/openglwin.cxx index d6fb9c46df9d..d6e5357236e7 100644 --- a/vcl/source/window/openglwin.cxx +++ b/vcl/source/window/openglwin.cxx @@ -40,6 +40,8 @@ OpenGLWindow::OpenGLWindow(Window* pParent): OpenGLWindow::~OpenGLWindow() { + if(mpRenderer) + mpRenderer->contextDestroyed(); } OpenGLContext* OpenGLWindow::getContext() |