chart2/source/view/charttypes/GL3DBarChart.cxx | 14 ++++++++++++-- chart2/source/view/inc/GL3DBarChart.hxx | 2 ++ chart2/source/view/inc/GL3DRenderer.hxx | 1 - chart2/source/view/main/GL3DRenderer.cxx | 19 +++++++++++++++++++ formula/source/ui/dlg/funcpage.cxx | 11 ++++------- include/vcl/opengl/OpenGLContext.hxx | 6 ++++-- include/vcl/openglwin.hxx | 2 ++ sc/source/filter/oox/workbookhelper.cxx | 2 ++ vcl/source/opengl/OpenGLContext.cxx | 7 +++++++ vcl/source/opengl/OpenGLHelper.cxx | 6 +++--- vcl/source/window/openglwin.cxx | 2 ++ 11 files changed, 57 insertions(+), 15 deletions(-)
New commits: commit 1ccbf70397adf07f1fe55f61c05ce1a741305cfc Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sat Jun 7 03:56:56 2014 +0200 don't try to import invalid document, fdo#79135 Change-Id: I3b601d629550078a8fa353bf838619f8d7b34718 diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 910d758..c3556c1 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -433,6 +433,8 @@ ScRangeData* WorkbookGlobals::createLocalNamedRangeObject( { ScDocument& rDoc = getScDocument(); ScRangeName* pNames = rDoc.GetRangeName( nTab ); + if(!pNames) + throw RuntimeException("invalid sheet index used"); // find an unused name orName = findUnusedName( pNames, orName ); // create the named range commit 71697a721075a9bb34ac4308c5524c4df93ab98c Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri May 23 03:01:35 2014 +0200 the variable is only available on linux diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index cba0b52..974f913 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -21,7 +21,7 @@ using namespace com::sun::star; GLWindow::~GLWindow() { -#if defined( UNX ) +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID XFree(vi); #endif } commit c9943f1d0d94b1138da78a17080213956e2fc248 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri May 23 02:24:56 2014 +0200 whitespace clean-up Change-Id: I10bdfc3356bda66fefa59fa2c9f63f9231d8728e diff --git a/formula/source/ui/dlg/funcpage.cxx b/formula/source/ui/dlg/funcpage.cxx index dd21c15..252e461 100644 --- a/formula/source/ui/dlg/funcpage.cxx +++ b/formula/source/ui/dlg/funcpage.cxx @@ -57,10 +57,6 @@ bool FormulaListBox::PreNotify( NotifyEvent& rNEvt ) return nResult; } - - - - inline sal_uInt16 Lb2Cat( sal_uInt16 nLbPos ) { // Category 0 == LRU, otherwise Categories == LbPos-1 @@ -70,8 +66,6 @@ inline sal_uInt16 Lb2Cat( sal_uInt16 nLbPos ) return nLbPos; } - - FuncPage::FuncPage(Window* pParent,const IFunctionManager* _pFunctionManager): TabPage(pParent,ModuleRes(RID_FORMULATAB_FUNCTION)), aFtCategory ( this, ModuleRes( FT_CATEGORY ) ), @@ -108,7 +102,7 @@ void FuncPage::impl_addFunctions(const IFunctionCategory* _pCategory) TFunctionDesc pDesc(_pCategory->getFunction(i)); aLbFunction.SetEntryData( aLbFunction.InsertEntry(pDesc->getFunctionName() ),(void*)pDesc ); - } // for(sal_uInt32 i = 0 ; i < nCount; ++i) + } } void FuncPage::UpdateFunctionList() @@ -194,10 +188,12 @@ void FuncPage::SetCategory(sal_Int32 nCat) aLbCategory.SelectEntryPos(nCat); UpdateFunctionList(); } + sal_Int32 FuncPage::GetFuncPos(const IFunctionDescription* _pDesc) { return aLbFunction.GetEntryPos(_pDesc); } + void FuncPage::SetFunction(sal_Int32 nFunc) { aLbFunction.SelectEntryPos(nFunc); @@ -227,6 +223,7 @@ OUString FuncPage::GetSelFunctionName() const { return aLbFunction.GetSelectEntry(); } + const IFunctionDescription* FuncPage::GetFuncDesc( sal_Int32 nPos ) const { // not pretty, but hopefully rare commit 160f171417540ec5ee80630c7cc488c260206e33 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri May 23 02:13:28 2014 +0200 we only support GLX 1.3+ Change-Id: I2447498cf92da91a7fb2d67ee041d603ae16fe25 diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index bceb8ff..608c9cb 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -96,7 +96,7 @@ struct GLWindow Display* dpy; int screen; XLIB_Window win; -#if defined( GLX_VERSION_1_3 ) && defined( GLX_EXT_texture_from_pixmap ) +#if defined( GLX_EXT_texture_from_pixmap ) GLXFBConfig fbc; #endif XVisualInfo* vi; @@ -123,7 +123,7 @@ struct GLWindow dpy(NULL), screen(0), win(0), -#if defined( GLX_VERSION_1_3 ) && defined( GLX_EXT_texture_from_pixmap ) +#if defined( GLX_EXT_texture_from_pixmap ) fbc(0), #endif vi(NULL), commit 7296f47cc989949f9fe9d0d914adda31c5a050b8 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri May 23 02:11:23 2014 +0200 Lsan: fix memory leak Change-Id: I82a517a267cceaac4dd1030d45c67fc070e22def diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index 7c233c9..bceb8ff 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -137,6 +137,8 @@ struct GLWindow bMultiSampleSupported(false) { } + + ~GLWindow(); }; class VCLOPENGL_DLLPUBLIC OpenGLContext diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index fb3bd72..cba0b52 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -19,6 +19,13 @@ using namespace com::sun::star; +GLWindow::~GLWindow() +{ +#if defined( UNX ) + XFree(vi); +#endif +} + OpenGLContext::OpenGLContext(): mpWindow(NULL), m_pChildWindow(NULL), commit 98199002993ab0a0b234287817ec66f92ca329ea Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri May 23 02:01:03 2014 +0200 Lsan: fix memory leak Change-Id: Id8adb7517960a33f9900cb773b62b84db71e795a diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index 50d5799..bace47b 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -38,14 +38,14 @@ OString loadShader(const OUString& rFilename) { sal_uInt64 nSize = 0; aFile.getSize(nSize); - char* content = new char[nSize+1]; + boost::scoped_array<char> content(new char[nSize+1]); sal_uInt64 nBytesRead = 0; - aFile.read(content, nSize, nBytesRead); + aFile.read(content.get(), nSize, nBytesRead); if(nSize != nBytesRead) assert(false); content[nSize] = 0; - return OString(content); + return OString(content.get()); } else { commit 5367bcf5d01681585872117d636e3293cf4046bb Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri May 23 01:58:41 2014 +0200 Lsan: fix memory leaks Change-Id: I010c7c194bf0680a499077b6b364498a09542764 diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx index a42220e..8c0b449 100644 --- a/chart2/source/view/main/GL3DRenderer.cxx +++ b/chart2/source/view/main/GL3DRenderer.cxx @@ -873,6 +873,8 @@ void OpenGL3DRenderer::RenderPolygon3DObject() polygon.verticesList.end(), DeletePointer<Vertices3D>()); std::for_each(polygon.normalsList.begin(), polygon.normalsList.end(), DeletePointer<Normals3D>()); + delete polygon.vertices; + delete polygon.normals; m_Polygon3DInfoList.pop_front(); } glDepthMask(GL_TRUE); commit dcfff1c3031987276709fa846a94b9e2a9ab44fd Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri May 23 01:44:58 2014 +0200 remove unused variable Change-Id: Ib79f0c525608d279eebe820bfc82e84dd3518c29 diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx index c2d7b87..6943012 100644 --- a/chart2/source/view/inc/GL3DRenderer.hxx +++ b/chart2/source/view/inc/GL3DRenderer.hxx @@ -84,7 +84,6 @@ struct Polygon3DInfo UVs3D *uvs; Normals3D *normals; std::list <Vertices3D *> verticesList; - std::list <UVs3D *> uvsList; std::list <Normals3D *> normalsList; MaterialParameters material; }; commit 8eab1ca570989591f3f6a44e74a56a72428a9922 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri May 23 01:41:49 2014 +0200 Lsan: fix memory leaks Change-Id: I35adb022f12c6833f4f29b2e8dad44394a2c4be5 diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx index d6c1dff..a42220e 100644 --- a/chart2/source/view/main/GL3DRenderer.cxx +++ b/chart2/source/view/main/GL3DRenderer.cxx @@ -840,6 +840,19 @@ void OpenGL3DRenderer::RenderPolygon3D(Polygon3DInfo &polygon) glUseProgram(0); } +namespace { + +template< typename T > +struct DeletePointer +{ + void operator()(T* p) + { + delete p; + } +}; + +} + void OpenGL3DRenderer::RenderPolygon3DObject() { glDepthMask(GL_FALSE); @@ -856,6 +869,10 @@ void OpenGL3DRenderer::RenderPolygon3DObject() { RenderPolygon3D(polygon); } + std::for_each(polygon.verticesList.begin(), + polygon.verticesList.end(), DeletePointer<Vertices3D>()); + std::for_each(polygon.normalsList.begin(), + polygon.normalsList.end(), DeletePointer<Normals3D>()); m_Polygon3DInfoList.pop_front(); } glDepthMask(GL_TRUE); commit bc0e7a03c0594fe298d277c4b0889ba55d6f5e7c Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Fri May 23 01:19:19 2014 +0200 Lsan: fix invalid memory access The chart object can be destroyed after the context. Change-Id: I5ae370638f296ea314ee11680e0a8d81a8fdbe69 diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index 542711a..036939e 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 cc252cf..674daf6 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 e9b823e..8e34d05 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 d6fb9c4..d6e5357 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() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits