[gjs: 4/12] function: Cleanup the completed trampolines removal in one call




commit 621e952b554aebc4784ea9437479dcf801b578ea
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed Sep 2 19:45:06 2020 +0200

    function: Cleanup the completed trampolines removal in one call

 gi/function.cpp | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/gi/function.cpp b/gi/function.cpp
index e1e326cd..7c1a2667 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -643,14 +643,9 @@ GjsCallbackTrampoline* gjs_callback_trampoline_new(
 static void
 complete_async_calls(void)
 {
-    if (completed_trampolines) {
-        for (GSList *iter = completed_trampolines; iter; iter = iter->next) {
-            auto trampoline = static_cast<GjsCallbackTrampoline *>(iter->data);
-            gjs_callback_trampoline_unref(trampoline);
-        }
-        g_slist_free(completed_trampolines);
-        completed_trampolines = nullptr;
-    }
+    g_slist_free_full(
+        static_cast<GSList*>(g_steal_pointer(&completed_trampolines)),
+        (GDestroyNotify)gjs_callback_trampoline_unref);
 }
 
 static void* get_return_ffi_pointer_from_giargument(


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]