From 2aea404b149eda40665dd517c3baff5a1e79a288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 14 Oct 2020 21:15:50 +0200 Subject: [PATCH] cogl: Use memory management helpers more https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496 --- cogl/cogl/cogl-framebuffer.c | 8 ++------ cogl/cogl/cogl-onscreen.c | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c index ba33bfcbc..1073685b6 100644 --- a/cogl/cogl/cogl-framebuffer.c +++ b/cogl/cogl/cogl-framebuffer.c @@ -887,13 +887,9 @@ _cogl_framebuffer_flush_dependency_journals (CoglFramebuffer *framebuffer) { CoglFramebufferPrivate *priv = cogl_framebuffer_get_instance_private (framebuffer); - GList *l; - for (l = priv->deps; l; l = l->next) - _cogl_framebuffer_flush_journal (l->data); - for (l = priv->deps; l; l = l->next) - g_object_unref (l->data); - g_list_free (priv->deps); + g_list_foreach (priv->deps, (GFunc) _cogl_framebuffer_flush_journal, NULL); + g_list_free_full (priv->deps, g_object_unref); priv->deps = NULL; } diff --git a/cogl/cogl/cogl-onscreen.c b/cogl/cogl/cogl-onscreen.c index d3585ba46..651f3a727 100644 --- a/cogl/cogl/cogl-onscreen.c +++ b/cogl/cogl/cogl-onscreen.c @@ -198,8 +198,8 @@ _cogl_dispatch_onscreen_cb (CoglContext *context) _cogl_list_insert_list (&queue, &context->onscreen_events_queue); _cogl_list_init (&context->onscreen_events_queue); - _cogl_closure_disconnect (context->onscreen_dispatch_idle); - context->onscreen_dispatch_idle = NULL; + g_clear_pointer (&context->onscreen_dispatch_idle, + _cogl_closure_disconnect); _cogl_list_for_each_safe (event, tmp, &queue, link) {