(new_ball_face) fixed memory leak for cairo patterns.

This commit is contained in:
Antonio Carzaniga 2021-12-12 11:54:43 +01:00
parent 53e71fa27d
commit f2203cfa00
2 changed files with 2 additions and 1 deletions

View File

@ -183,6 +183,7 @@ static struct ball_face * new_ball_face(unsigned int radius, cairo_surface_t * f
cairo_set_source (ball_cr, pat); cairo_set_source (ball_cr, pat);
cairo_arc (ball_cr, 0.0, 0.0, radius, 0, 2 * M_PI); cairo_arc (ball_cr, 0.0, 0.0, radius, 0, 2 * M_PI);
cairo_fill (ball_cr); cairo_fill (ball_cr);
cairo_pattern_destroy (pat);
} }
cairo_surface_flush(f->c_faces[i]); cairo_surface_flush(f->c_faces[i]);
cairo_destroy(ball_cr); cairo_destroy(ball_cr);

View File

@ -20,7 +20,7 @@ void gravity_constant_field (double x, double y) {
g_x = x; g_x = x;
g_y = y; g_y = y;
} }
void gravity_newton_field (double r, double g) { void gravity_newton_field (double r, double g) {
constant_field = 0; constant_field = 0;
g_r = r; g_r = r;