From 8dfe4af76b71d4d721bfe8484faa992a7f497a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 9 Jan 2019 18:46:24 +0100 Subject: [PATCH] bar: call cairo_device_finish() on the surface's device This fixes lots of memory leaks detected by valgrind. Unsure if this is how you're supposed to shutdown cairo. You'd think (from the documentation) that destroying the surface would (when the refcount reaches 0) destroy the device too... --- bar.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bar.c b/bar.c index d2963db..2ec3b6d 100644 --- a/bar.c +++ b/bar.c @@ -702,6 +702,8 @@ run(struct bar_run_context *run_ctx) } cairo_destroy(bar->cairo); + cairo_device_finish(cairo_surface_get_device(bar->cairo_surface)); + cairo_surface_finish(bar->cairo_surface); cairo_surface_destroy(bar->cairo_surface); cairo_debug_reset_static_data();