Fix multiple memory leaks found with LeakSanitizer.

pull/33/head
whitequark 2016-08-07 19:33:42 +00:00
parent fbe2705ebe
commit 8bf55b3c62
5 changed files with 16 additions and 5 deletions

View File

@ -389,6 +389,8 @@ void GraphicsWindow::HitTestMakeSelection(Point2d mp) {
}
}
canvas.Clear();
if(!s.Equals(&hover)) {
hover = s;
PaintGraphics();
@ -787,5 +789,6 @@ void GraphicsWindow::Paint() {
}
canvas.EndFrame();
canvas.Clear();
#endif
}

View File

@ -1187,19 +1187,21 @@ void Constraint::Draw(DrawAs how, Canvas *canvas) {
}
Vector Constraint::GetLabelPos(const Camera &camera) {
Vector p;
ObjectPicker canvas = {};
canvas.camera = camera;
Vector p;
DoLayout(DrawAs::DEFAULT, &canvas, &p, NULL);
canvas.Clear();
return p;
}
void Constraint::GetReferencePoints(const Camera &camera, std::vector<Vector> *refs) {
ObjectPicker canvas = {};
canvas.camera = camera;
DoLayout(DrawAs::DEFAULT, &canvas, NULL, refs);
canvas.Clear();
}
bool Constraint::IsStylable() const {

View File

@ -126,14 +126,17 @@ void Entity::GetReferencePoints(std::vector<Vector> *refs) {
}
int Entity::GetPositionOfPoint(const Camera &camera, Point2d p) {
int position;
ObjectPicker canvas = {};
canvas.camera = camera;
canvas.point = p;
canvas.minDistance = 1e12;
Draw(DrawAs::DEFAULT, &canvas);
position = canvas.position;
canvas.Clear();
return canvas.position;
return position;
}
bool Entity::IsStylable() const {

View File

@ -220,6 +220,8 @@ void SolveSpaceUI::ExportViewOrWireframeTo(const std::string &filename, bool exp
for(Constraint &c : SK.constraint) {
c.Draw(Constraint::DrawAs::DEFAULT, &canvas);
}
canvas.Clear();
}
}

View File

@ -858,6 +858,7 @@ void TextWindow::Paint() {
DrawOrHitTestColorPicker(&uiCanvas, PAINT, false, 0, 0);
canvas.EndFrame();
canvas.Clear();
#endif
}