starmath/inc/document.hxx | 2 ++ starmath/source/document.cxx | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-)
New commits: commit ef66cc105e0051fa1414b72c5ee2bf1b2f9331cb Author: Marcos Paulo de Souza <marcos.souza....@gmail.com> Date: Thu Jul 25 01:14:03 2013 -0300 Fix memory leak in Math, by holding SmModel pointer And deleting this in destructor of SmDocShell Change-Id: Ida96648c7aae90fb5b0afac916587bbb049f90b3 Reviewed-on: https://gerrit.libreoffice.org/5088 Reviewed-by: Fridrich Strba <fridr...@documentfoundation.org> Tested-by: Fridrich Strba <fridr...@documentfoundation.org> diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index 4446ad0..f86207d 100644 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -39,6 +39,7 @@ #include "format.hxx" #include "parse.hxx" #include "smmod.hxx" +#include "unomodel.hxx" class SmNode; class SfxMenuBarManager; @@ -95,6 +96,7 @@ class SmDocShell : public SfxObjectShell, public SfxListener OUString aText; SmFormat aFormat; SmParser aInterpreter; + SmModel *pModel; OUString aAccText; SmNode *pTree; SfxMenuBarManager *pMenuMgr; diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index e49faec..edc635e 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -684,6 +684,7 @@ void SmDocShell::Repaint() SmDocShell::SmDocShell( const sal_uInt64 i_nSfxCreationFlags ) : SfxObjectShell( i_nSfxCreationFlags ), + pModel ( new SmModel(this) ), pTree ( 0 ), pEditEngineItemPool ( 0 ), pEditEngine ( 0 ), @@ -703,11 +704,9 @@ SmDocShell::SmDocShell( const sal_uInt64 i_nSfxCreationFlags ) : StartListening(aFormat); StartListening(*pp->GetConfig()); - SetBaseModel( new SmModel(this) ); + SetBaseModel( pModel ); } - - SmDocShell::~SmDocShell() { SAL_INFO( "starmath", "starmath: SmDocShell::~SmDocShell" ); @@ -717,7 +716,6 @@ SmDocShell::~SmDocShell() EndListening(aFormat); EndListening(*pp->GetConfig()); - if(pCursor) delete pCursor; pCursor = NULL; @@ -726,6 +724,7 @@ SmDocShell::~SmDocShell() SfxItemPool::Free(pEditEngineItemPool); delete pTree; delete pPrinter; + delete pModel; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits