0000721: massive memory leak when dragging an unconstrained model

This commit is contained in:
wmayer 2012-11-15 00:24:40 +01:00
parent 95880a7093
commit 09866ae81b

View File

@ -129,9 +129,7 @@ void SoDatumLabel::drawImage()
painter.drawText(0,0,w,h, Qt::AlignLeft , str);
painter.end();
SoSFImage sfimage;
Gui::BitmapFactory().convert(image, sfimage);
this->image = sfimage;
Gui::BitmapFactory().convert(image, this->image);
}
void SoDatumLabel::computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center)
@ -156,8 +154,6 @@ void SoDatumLabel::generatePrimitives(SoAction * action)
SbVec3f p1 = pnts[0];
SbVec3f p2 = pnts[1];
float offsetX, offsetY;
// Change the offset and bounding box parameters depending on Datum Type
if(this->datumtype.getValue() == DISTANCE || this->datumtype.getValue() == DISTANCEX || this->datumtype.getValue() == DISTANCEY ){
@ -440,7 +436,7 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
}
// Position for Datum Text Label
float offsetX, offsetY, angle;
float angle;
SbVec3f textOffset;
@ -487,10 +483,10 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
angle = atan2f(dir[1],dir[0]);
bool flip=false;
if (angle > M_PI_2+M_PI/12) {
angle -= M_PI;
angle -= (float)M_PI;
flip = true;
} else if (angle <= -M_PI_2+M_PI/12) {
angle += M_PI;
angle += (float)M_PI;
flip = true;
}
@ -602,10 +598,10 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
angle = atan2f(dir[1],dir[0]);
bool flip=false;
if (angle > M_PI_2+M_PI/12) {
angle -= M_PI;
angle -= (float)M_PI;
flip = true;
} else if (angle <= -M_PI_2+M_PI/12) {
angle += M_PI;
angle += (float)M_PI;
flip = true;
}
@ -847,12 +843,19 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
glEnable(GL_TEXTURE_2D); // Enable Textures
glEnable(GL_BLEND);
// wmayer: see bug report below which is caused by generating but not
// deleting the texture. I guess we don't need this texture and thus
// comment out the block.
// #0000721: massive memory leak when dragging an unconstrained model
//
#if 0
// Copy the text bitmap into memory and bind
GLuint myTexture;
// generate a texture
glGenTextures(1, &myTexture);
glBindTexture(GL_TEXTURE_2D, myTexture);
#endif
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@ -880,6 +883,9 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
// Reset the Mode
glPopMatrix();
#if 0
glDeleteTextures(1, &myTexture);
#endif
}
glPopAttrib();