Kaydet (Commit) 355c3cbb authored tarafından Markus Mohrhard's avatar Markus Mohrhard

fix invalid memory access in chart tests

Change-Id: I056101d146c939ff958c83efc57fd110e8d52509
üst d781e874
...@@ -197,6 +197,7 @@ public: ...@@ -197,6 +197,7 @@ public:
std::exception) SAL_OVERRIDE; std::exception) SAL_OVERRIDE;
void setViewDirty(); void setViewDirty();
void updateOpenGLWindow();
private: //methods private: //methods
ChartView(); ChartView();
......
...@@ -1429,6 +1429,8 @@ void ChartModel::update() ...@@ -1429,6 +1429,8 @@ void ChartModel::update()
mpChartView->setViewDirty(); mpChartView->setViewDirty();
mpChartView->update(); mpChartView->update();
if(mpChartView)
mpChartView->updateOpenGLWindow();
} }
......
...@@ -165,22 +165,25 @@ public: ...@@ -165,22 +165,25 @@ public:
virtual void mouseDragMove(const Point& rBegin, const Point& rEnd, sal_uInt16 nButton) SAL_OVERRIDE; virtual void mouseDragMove(const Point& rBegin, const Point& rEnd, sal_uInt16 nButton) SAL_OVERRIDE;
virtual void scroll(long nDelta) SAL_OVERRIDE; virtual void scroll(long nDelta) SAL_OVERRIDE;
virtual void contextDestroyed() SAL_OVERRIDE; virtual void contextDestroyed() SAL_OVERRIDE;
void updateOpenGLWindow();
private: private:
ChartView* mpView; ChartView* mpView;
bool mbContextDestroyed; bool mbContextDestroyed;
OpenGLWindow* mpWindow;
}; };
GL2DRenderer::GL2DRenderer(ChartView* pView): GL2DRenderer::GL2DRenderer(ChartView* pView):
mpView(pView), mpView(pView),
mbContextDestroyed(false) mbContextDestroyed(false),
mpWindow(mpView->mrChartModel.getOpenGLWindow())
{ {
} }
GL2DRenderer::~GL2DRenderer() GL2DRenderer::~GL2DRenderer()
{ {
OpenGLWindow* pWindow = mpView->mrChartModel.getOpenGLWindow(); if(!mbContextDestroyed && mpWindow)
if(!mbContextDestroyed &&pWindow) mpWindow->setRenderer(NULL);
pWindow->setRenderer(NULL);
} }
void GL2DRenderer::update() void GL2DRenderer::update()
...@@ -205,6 +208,27 @@ void GL2DRenderer::contextDestroyed() ...@@ -205,6 +208,27 @@ void GL2DRenderer::contextDestroyed()
mbContextDestroyed = true; 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() const uno::Sequence<sal_Int8>& ExplicitValueProvider::getUnoTunnelId()
{ {
return theExplicitValueProviderUnoTunnelId::get().getSeq(); return theExplicitValueProviderUnoTunnelId::get().getSeq();
...@@ -3256,6 +3280,11 @@ void ChartView::createShapes3D() ...@@ -3256,6 +3280,11 @@ void ChartView::createShapes3D()
m_pGL3DPlotter->render(); m_pGL3DPlotter->render();
} }
void ChartView::updateOpenGLWindow()
{
mp2DRenderer->updateOpenGLWindow();
}
} //namespace chart } //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment