summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-06-26 13:47:38 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-06-27 10:05:45 +0200
commit355c3cbb16b0bab705050dd24205878bcecd5687 (patch)
tree9c4d115e53ff6318ec43e2ae6124c355ad57b494
parentd781e874e018988d26b558ae1e4d6a1303b14cc1 (diff)
fix invalid memory access in chart tests
Change-Id: I056101d146c939ff958c83efc57fd110e8d52509
-rw-r--r--chart2/inc/ChartView.hxx1
-rw-r--r--chart2/source/model/main/ChartModel.cxx2
-rw-r--r--chart2/source/view/main/ChartView.cxx37
3 files changed, 36 insertions, 4 deletions
diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx
index d69aa9f86225..4f2b961ba7ef 100644
--- a/chart2/inc/ChartView.hxx
+++ b/chart2/inc/ChartView.hxx
@@ -197,6 +197,7 @@ public:
std::exception) SAL_OVERRIDE;
void setViewDirty();
+ void updateOpenGLWindow();
private: //methods
ChartView();
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 02c123477eb9..e127cf307cc7 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -1429,6 +1429,8 @@ void ChartModel::update()
mpChartView->setViewDirty();
mpChartView->update();
+ if(mpChartView)
+ mpChartView->updateOpenGLWindow();
}
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 9142b3e6e617..116791a12f97 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -165,22 +165,25 @@ public:
virtual void mouseDragMove(const Point& rBegin, const Point& rEnd, sal_uInt16 nButton) SAL_OVERRIDE;
virtual void scroll(long nDelta) SAL_OVERRIDE;
virtual void contextDestroyed() SAL_OVERRIDE;
+
+ void updateOpenGLWindow();
private:
ChartView* mpView;
bool mbContextDestroyed;
+ OpenGLWindow* mpWindow;
};
GL2DRenderer::GL2DRenderer(ChartView* pView):
mpView(pView),
- mbContextDestroyed(false)
+ mbContextDestroyed(false),
+ mpWindow(mpView->mrChartModel.getOpenGLWindow())
{
}
GL2DRenderer::~GL2DRenderer()
{
- OpenGLWindow* pWindow = mpView->mrChartModel.getOpenGLWindow();
- if(!mbContextDestroyed &&pWindow)
- pWindow->setRenderer(NULL);
+ if(!mbContextDestroyed && mpWindow)
+ mpWindow->setRenderer(NULL);
}
void GL2DRenderer::update()
@@ -205,6 +208,27 @@ void GL2DRenderer::contextDestroyed()
mbContextDestroyed = true;
}
+void GL2DRenderer::updateOpenGLWindow()
+{
+ if(mbContextDestroyed)
+ return;
+
+ OpenGLWindow* pWindow = mpView->mrChartModel.getOpenGLWindow();
+ if(pWindow != mpWindow)
+ {
+ if(mpWindow)
+ {
+ mpWindow->setRenderer(NULL);
+ }
+
+ if(pWindow)
+ {
+ pWindow->setRenderer(this);
+ }
+ }
+ mpWindow = pWindow;
+}
+
const uno::Sequence<sal_Int8>& ExplicitValueProvider::getUnoTunnelId()
{
return theExplicitValueProviderUnoTunnelId::get().getSeq();
@@ -3256,6 +3280,11 @@ void ChartView::createShapes3D()
m_pGL3DPlotter->render();
}
+void ChartView::updateOpenGLWindow()
+{
+ mp2DRenderer->updateOpenGLWindow();
+}
+
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */