diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-05-31 18:02:43 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-05-31 18:02:43 +0400 |
commit | 134739106023f3f7635ad1a128c7f77044b40884 (patch) | |
tree | d623bd2ed2a0261ef7659b1996a8e3643a760278 /source | |
parent | 0ea46073085676ed4dc5c0d0e18420205c80c86b (diff) |
Fix for memory leak:
Manipulator drawing, enabled or disabled, with the exception of the
combo manipulator, was leaking a GLU quadric on every redraw.
I don't think this caused trouble in practical situations though, it
leaked about 1 MB when running Alt+A for 20 minutes here.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/src/transform_manipulator.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/src/transform_manipulator.c b/source/blender/src/transform_manipulator.c index 765c74461f2..773ae3d17ec 100644 --- a/source/blender/src/transform_manipulator.c +++ b/source/blender/src/transform_manipulator.c @@ -697,11 +697,13 @@ static void draw_manipulator_axes(int colcode, int flagx, int flagy, int flagz) /* only called while G.moving */ static void draw_manipulator_rotate_ghost(float mat[][4], int drawflags) { - GLUquadricObj *qobj= gluNewQuadric(); + GLUquadricObj *qobj; float size, phi, startphi, vec[3], svec[3], matt[4][4], cross[3], tmat[3][3]; int arcs= (G.rt!=2); glDisable(GL_DEPTH_TEST); + + qobj= gluNewQuadric(); gluQuadricDrawStyle(qobj, GLU_FILL); glColor4ub(0,0,0,64); @@ -832,7 +834,7 @@ static void draw_manipulator_rotate_ghost(float mat[][4], int drawflags) static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags, int combo) { - GLUquadricObj *qobj= gluNewQuadric(); + GLUquadricObj *qobj; double plane[4]; float size, vec[3], unitmat[4][4]; float cywid= 0.33f*0.01f*(float)U.tw_handlesize; @@ -849,6 +851,8 @@ static void draw_manipulator_rotate(float mat[][4], int moving, int drawflags, i /* Init stuff */ glDisable(GL_DEPTH_TEST); Mat4One(unitmat); + + qobj= gluNewQuadric(); gluQuadricDrawStyle(qobj, GLU_FILL); /* prepare for screen aligned draw */ @@ -1153,7 +1157,7 @@ static void draw_cylinder(GLUquadricObj *qobj, float len, float width) static void draw_manipulator_translate(float mat[][4], int moving, int drawflags, int combo, int colcode) { - GLUquadricObj *qobj = gluNewQuadric(); + GLUquadricObj *qobj; float cylen= 0.01f*(float)U.tw_handlesize; float cywid= 0.25f*cylen, dz, size; float unitmat[4][4]; @@ -1163,6 +1167,8 @@ static void draw_manipulator_translate(float mat[][4], int moving, int drawflags if(moving) glTranslatef(Trans.vec[0], Trans.vec[1], Trans.vec[2]); glDisable(GL_DEPTH_TEST); + + qobj= gluNewQuadric(); gluQuadricDrawStyle(qobj, GLU_FILL); /* center circle, do not add to selection when shift is pressed (planar constraint) */ @@ -1225,19 +1231,21 @@ static void draw_manipulator_translate(float mat[][4], int moving, int drawflags static void draw_manipulator_rotate_cyl(float mat[][4], int moving, int drawflags, int combo, int colcode) { - GLUquadricObj *qobj = gluNewQuadric(); + GLUquadricObj *qobj; float size; float cylen= 0.01f*(float)U.tw_handlesize; float cywid= 0.25f*cylen; /* when called while moving in mixed mode, do not draw when... */ if((drawflags & MAN_ROT_C)==0) return; - + /* prepare for screen aligned draw */ glPushMatrix(); size= screen_aligned(mat); glDisable(GL_DEPTH_TEST); + + qobj= gluNewQuadric(); /* Screen aligned view rot circle */ if(drawflags & MAN_ROT_V) { |