From: stv Date: Thu, 5 Oct 2006 07:18:03 +0000 (+0000) Subject: Some memory leaks were removed X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9dee2410601275c619d813050c1749d798c8a85d;p=modules%2Fgui.git Some memory leaks were removed --- diff --git a/src/GLViewer/GLViewer_Object.cxx b/src/GLViewer/GLViewer_Object.cxx index cb0920108..65e4849a0 100644 --- a/src/GLViewer/GLViewer_Object.cxx +++ b/src/GLViewer/GLViewer_Object.cxx @@ -66,17 +66,20 @@ GLViewer_Object::GLViewer_Object() */ GLViewer_Object::~GLViewer_Object() { - if( myRect ) + if ( myRect ) delete myRect; - if( myUpdateRect ) + if ( myUpdateRect ) delete myUpdateRect; - if( myGLText ) + if ( myGLText ) delete myGLText; - if( myAspectLine ) + if ( myAspectLine ) delete myAspectLine; + + if ( myOwner ) + delete myOwner; } /*! @@ -87,6 +90,16 @@ int GLViewer_Object::getPriority() const return myDrawer ? myDrawer->getPriority() : 0; } +void GLViewer_Object::setOwner( SUIT_DataOwner* owner ) +{ + if ( myOwner == owner ) + return; + + if ( myOwner ) + delete myOwner; + myOwner = owner; +} + /*! \return true if object is inside rectangle \param theRect - rectangle diff --git a/src/GLViewer/GLViewer_Object.h b/src/GLViewer/GLViewer_Object.h index 6ac66583e..83419d465 100644 --- a/src/GLViewer/GLViewer_Object.h +++ b/src/GLViewer/GLViewer_Object.h @@ -235,7 +235,7 @@ public: //!\warning It is for ouv SUIT_DataOwner* owner() const { return myOwner; } //!\warning It is for ouv - void setOwner( SUIT_DataOwner* owner ) { myOwner = owner; } + void setOwner( SUIT_DataOwner* owner ); //! Adds object to group theGroup void setGroup( GLViewer_Group* theGroup ); diff --git a/src/LightApp/LightApp_OBFilter.cxx b/src/LightApp/LightApp_OBFilter.cxx index b15720271..252260df3 100644 --- a/src/LightApp/LightApp_OBFilter.cxx +++ b/src/LightApp/LightApp_OBFilter.cxx @@ -40,7 +40,7 @@ bool LightApp_OBFilter::isOk( const SUIT_DataObject* theDataObj ) const { const LightApp_DataObject* obj = dynamic_cast( theDataObj ); if ( obj ) - return mySelMgr->isOk( new LightApp_DataOwner( obj->entry() ) ); + return mySelMgr->isOk( SUIT_DataOwnerPtr( new LightApp_DataOwner( obj->entry() ) ) ); return true; }