From 1ae408e2c84fbca6275bb76c497924add999e34b Mon Sep 17 00:00:00 2001 From: ouv Date: Thu, 3 Sep 2009 08:19:53 +0000 Subject: [PATCH] To avoid memory leaks --- src/Qtx/QtxDockAction.cxx | 6 ++++++ src/Qtx/QtxMultiAction.cxx | 6 ++++++ src/SVTK/SALOME_Actor.cxx | 1 + src/SVTK/SVTK_ViewWindow.cxx | 4 +++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Qtx/QtxDockAction.cxx b/src/Qtx/QtxDockAction.cxx index caba437b6..0b6d6e2d5 100755 --- a/src/Qtx/QtxDockAction.cxx +++ b/src/Qtx/QtxDockAction.cxx @@ -86,6 +86,12 @@ QtxDockAction::QtxDockAction( const QString& text, const QIcon& icon, const QStr */ QtxDockAction::~QtxDockAction() { + // to avoid memory leak + if( QMenu* aMenu = menu() ) + { + delete aMenu; + aMenu = 0; + } } /*! diff --git a/src/Qtx/QtxMultiAction.cxx b/src/Qtx/QtxMultiAction.cxx index eb8bf5190..9859c9e32 100644 --- a/src/Qtx/QtxMultiAction.cxx +++ b/src/Qtx/QtxMultiAction.cxx @@ -216,6 +216,12 @@ QtxMultiAction::QtxMultiAction( const QIcon& ico, const QString& txt, QObject* p */ QtxMultiAction::~QtxMultiAction() { + // to avoid memory leak + if( QMenu* aMenu = menu() ) + { + delete aMenu; + aMenu = 0; + } } /*! diff --git a/src/SVTK/SALOME_Actor.cxx b/src/SVTK/SALOME_Actor.cxx index eb7a8a701..3aceebf27 100644 --- a/src/SVTK/SALOME_Actor.cxx +++ b/src/SVTK/SALOME_Actor.cxx @@ -386,6 +386,7 @@ SALOME_Actor aProp->SetColor( 255, 255, 255); aProp->SetLineWidth ( 3 ); myPreHighlightActor->SetProperty(aProp); + aProp->Delete(); int vis = myPreHighlightActor->GetVisibility(); //printf ("\n Visibility = %d", vis); diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index b5b67ddc7..d9f7d1f67 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -212,7 +212,9 @@ void SVTK_ViewWindow::Initialize(SVTK_View* theView, Destructor */ SVTK_ViewWindow::~SVTK_ViewWindow() -{} +{ + myRecorder->Delete(); +} /*! -- 2.39.2