Salome HOME
projects
/
modules
/
gui.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1764456
)
Fix memory freed
author
CHEMIN Sebastien
<sc236498@is245491.intra.cea.fr>
Mon, 4 Dec 2023 08:00:30 +0000
(09:00 +0100)
committer
Nabil Ghodbane
<nabil.ghodbane@cea.fr>
Wed, 28 Feb 2024 14:15:01 +0000
(15:15 +0100)
src/GLViewer/GLViewer_BaseObjects.cxx
patch
|
blob
|
history
src/GLViewer/GLViewer_BaseObjects.h
patch
|
blob
|
history
src/GLViewer/GLViewer_Context.cxx
patch
|
blob
|
history
src/GLViewer/GLViewer_Object.cxx
patch
|
blob
|
history
src/GLViewer/GLViewer_Viewer2d.cxx
patch
|
blob
|
history
diff --git
a/src/GLViewer/GLViewer_BaseObjects.cxx
b/src/GLViewer/GLViewer_BaseObjects.cxx
index 013270f4d55a9872b88a4b57e9ed013439975cd5..8189cb13fb240c7f3f54c093259e2b868b04e8bd 100644
(file)
--- a/
src/GLViewer/GLViewer_BaseObjects.cxx
+++ b/
src/GLViewer/GLViewer_BaseObjects.cxx
@@
-59,10
+59,11
@@
GLViewer_MarkerSet::GLViewer_MarkerSet( int number, float size, const QString& t
*/
GLViewer_MarkerSet::~GLViewer_MarkerSet()
{
*/
GLViewer_MarkerSet::~GLViewer_MarkerSet()
{
- if ( myXCoord )
- delete[] myXCoord;
- if ( myYCoord )
- delete[] myYCoord;
+ delete[] myXCoord;
+ delete[] myYCoord;
+
+ myXCoord = nullptr;
+ myYCoord = nullptr;
}
/*!
}
/*!
@@
-590,6
+591,9
@@
GLViewer_Rect* GLViewer_MarkerSet::getUpdateRect()
*/
void GLViewer_MarkerSet::setXCoord( GLfloat* xCoord, int size )
{
*/
void GLViewer_MarkerSet::setXCoord( GLfloat* xCoord, int size )
{
+ delete[] myXCoord;
+ myXCoord = nullptr;
+
myXCoord = new GLfloat[ size ];
for( int i = 0; i < size; i++ )
myXCoord[i] = xCoord[i];
myXCoord = new GLfloat[ size ];
for( int i = 0; i < size; i++ )
myXCoord[i] = xCoord[i];
@@
-602,6
+606,9
@@
void GLViewer_MarkerSet::setXCoord( GLfloat* xCoord, int size )
*/
void GLViewer_MarkerSet::setYCoord( GLfloat* yCoord, int size )
{
*/
void GLViewer_MarkerSet::setYCoord( GLfloat* yCoord, int size )
{
+ delete[] myYCoord;
+ myYCoord = nullptr;
+
myYCoord = new GLfloat[ size ];
for( int i = 0; i < size; i++ )
myYCoord[i] = yCoord[i];
myYCoord = new GLfloat[ size ];
for( int i = 0; i < size; i++ )
myYCoord[i] = yCoord[i];
@@
-840,10
+847,11
@@
GLViewer_Polyline::GLViewer_Polyline( int number, float /*size*/, const QString&
*/
GLViewer_Polyline::~GLViewer_Polyline()
{
*/
GLViewer_Polyline::~GLViewer_Polyline()
{
- if ( myXCoord )
- delete[] myXCoord;
- if ( myYCoord )
- delete[] myYCoord;
+ delete[] myXCoord;
+ delete[] myYCoord;
+
+ myXCoord = nullptr;
+ myYCoord = nullptr;
}
/*!
}
/*!
@@
-993,7
+1001,9
@@
GLViewer_Rect* GLViewer_Polyline::getUpdateRect()
GLViewer_Drawer* GLViewer_Polyline::createDrawer()
{
// cout << "GLViewer_MarkerSet::createDrawer" << endl;
GLViewer_Drawer* GLViewer_Polyline::createDrawer()
{
// cout << "GLViewer_MarkerSet::createDrawer" << endl;
- return myDrawer = new GLViewer_PolylineDrawer();
+ delete myDrawer;
+ myDrawer = nullptr;
+ return myDrawer = new GLViewer_PolylineDrawer();
}
/*!
}
/*!
@@
-1177,6
+1187,9
@@
GLboolean GLViewer_Polyline::unselect()
*/
void GLViewer_Polyline::setXCoord( GLfloat* xCoord, int size )
{
*/
void GLViewer_Polyline::setXCoord( GLfloat* xCoord, int size )
{
+ delete[] myXCoord;
+ myXCoord = nullptr;
+
myXCoord = new GLfloat[ size ];
for( int i = 0; i < size; i++ )
myXCoord[i] = xCoord[i];
myXCoord = new GLfloat[ size ];
for( int i = 0; i < size; i++ )
myXCoord[i] = xCoord[i];
@@
-1189,6
+1202,9
@@
void GLViewer_Polyline::setXCoord( GLfloat* xCoord, int size )
*/
void GLViewer_Polyline::setYCoord( GLfloat* yCoord, int size )
{
*/
void GLViewer_Polyline::setYCoord( GLfloat* yCoord, int size )
{
+ delete[] myYCoord;
+ myYCoord = nullptr;
+
myYCoord = new GLfloat[ size ];
for( int i = 0; i < size; i++ )
myYCoord[i] = yCoord[i];
myYCoord = new GLfloat[ size ];
for( int i = 0; i < size; i++ )
myYCoord[i] = yCoord[i];
diff --git
a/src/GLViewer/GLViewer_BaseObjects.h
b/src/GLViewer/GLViewer_BaseObjects.h
index 7410d9443fa23deea3cb544df39ee23d57fc88f9..93d252e9e266b3fc6e5205047fecf3424d02ca16 100644
(file)
--- a/
src/GLViewer/GLViewer_BaseObjects.h
+++ b/
src/GLViewer/GLViewer_BaseObjects.h
@@
-127,7
+127,7
@@
class GLVIEWER_API GLViewer_Polyline: public GLViewer_Object
{
public:
GLViewer_Polyline( int number = 1, float size = 5.0, const QString& toolTip = "GLPolyline" );
{
public:
GLViewer_Polyline( int number = 1, float size = 5.0, const QString& toolTip = "GLPolyline" );
- ~GLViewer_Polyline();
+
virtual
~GLViewer_Polyline();
// redefined methods
virtual void compute();
// redefined methods
virtual void compute();
diff --git
a/src/GLViewer/GLViewer_Context.cxx
b/src/GLViewer/GLViewer_Context.cxx
index ebbe2bfc1fa5997b7f0713fe05b80465e29b8004..2667999ef230e57e8353562b52fe587a7f8362d8 100644
(file)
--- a/
src/GLViewer/GLViewer_Context.cxx
+++ b/
src/GLViewer/GLViewer_Context.cxx
@@
-69,9
+69,13
@@
GLViewer_Context::GLViewer_Context( GLViewer_Viewer2d* v ) :
*/
GLViewer_Context::~GLViewer_Context()
{
*/
GLViewer_Context::~GLViewer_Context()
{
- myActiveObjects.clear();
- myInactiveObjects.clear();
- mySelectedObjects.clear();
+ qDeleteAll(myActiveObjects);
+ myActiveObjects.clear();
+
+ qDeleteAll(myInactiveObjects);
+ myInactiveObjects.clear();
+
+ mySelectedObjects.clear();
}
/*!
}
/*!
@@
-115,6
+119,8
@@
int GLViewer_Context::MoveTo( int xi, int yi, bool byCircle )
object->highlight( x, y, myTolerance, GL_FALSE );
isHigh = object->isHighlighted();
}
object->highlight( x, y, myTolerance, GL_FALSE );
isHigh = object->isHighlighted();
}
+ delete rect;
+ rect = nullptr;
if( isHigh )
{
if( isHigh )
{
diff --git
a/src/GLViewer/GLViewer_Object.cxx
b/src/GLViewer/GLViewer_Object.cxx
index ad2facde512d4e82409cb5ee79a394e6fc960b1f..271daceabae73a7870314095e0b04ee0cd3e7bbb 100644
(file)
--- a/
src/GLViewer/GLViewer_Object.cxx
+++ b/
src/GLViewer/GLViewer_Object.cxx
@@
-42,8
+42,8
@@
GLViewer_Object::GLViewer_Object()
myIsHigh = GL_FALSE;
myIsSel = GL_FALSE;
myIsHigh = GL_FALSE;
myIsSel = GL_FALSE;
- myRect = new GLViewer_Rect();
;
- myUpdateRect = new GLViewer_Rect();
;
+ myRect = new GLViewer_Rect();
+ myUpdateRect = new GLViewer_Rect();
myGLText = new GLViewer_Text( 0, 0, 0, QColor(0,0,0) );
myAspectLine = new GLViewer_AspectLine();
myGLText = new GLViewer_Text( 0, 0, 0, QColor(0,0,0) );
myAspectLine = new GLViewer_AspectLine();
@@
-64,17
+64,20
@@
GLViewer_Object::GLViewer_Object()
*/
GLViewer_Object::~GLViewer_Object()
{
*/
GLViewer_Object::~GLViewer_Object()
{
- if( myRect )
-
delete myRect
;
+ delete myRect;
+
myRect = nullptr
;
- if( myUpdateRect )
-
delete myUpdateRect
;
+ delete myUpdateRect;
+
myUpdateRect = nullptr
;
- if( myGLText )
-
delete myGLText
;
+ delete myGLText;
+
myGLText = nullptr
;
- if( myAspectLine )
- delete myAspectLine;
+ delete myAspectLine;
+ myAspectLine = nullptr;
+
+ delete myOwner;
+ myOwner = nullptr;
}
/*!
}
/*!
diff --git
a/src/GLViewer/GLViewer_Viewer2d.cxx
b/src/GLViewer/GLViewer_Viewer2d.cxx
index b1667f4c4655129058f5d379e99f583c5537b49a..b55eea2be320d4e07be17b64e733ba52d39e1515 100644
(file)
--- a/
src/GLViewer/GLViewer_Viewer2d.cxx
+++ b/
src/GLViewer/GLViewer_Viewer2d.cxx
@@
-69,6
+69,13
@@
GLViewer_Viewer2d::~GLViewer_Viewer2d()
{
//myGLSketcher = 0;
//delete myGLSketcher;
{
//myGLSketcher = 0;
//delete myGLSketcher;
+
+ qDeleteAll(myDrawers);
+ myDrawers.clear();
+
+ delete myGLContext;
+ myGLContext = nullptr;
+
GLViewer_TexFont::clearTextBases();
}
GLViewer_TexFont::clearTextBases();
}