[gjs/wip/ptomato/develop: 7/11] object: Remove vfunc list



commit 874d883696f8d05173b60386a5d4386ca628db62
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon Sep 18 23:16:11 2017 -0700

    object: Remove vfunc list
    
    This was made obsolete by the recent commit to treat vfuncs as closures.
    We were actually tracing vfuncs twice.

 gi/object.cpp |   12 ------------
 1 files changed, 0 insertions(+), 12 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 8c4b005..94c8ee2 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -23,7 +23,6 @@
 
 #include <config.h>
 
-#include <deque>
 #include <memory>
 #include <set>
 #include <stack>
@@ -69,9 +68,6 @@ struct ObjectInstance {
        prototypes) */
     GTypeClass *klass;
 
-    /* A list of all vfunc trampolines, used when tracing */
-    std::deque<GjsCallbackTrampoline *> vfuncs;
-
     unsigned js_object_finalized : 1;
 };
 
@@ -1427,9 +1423,6 @@ object_instance_trace(JSTracer *tracer,
 
     for (GClosure *closure : priv->closures)
         gjs_closure_trace(closure, tracer);
-
-    for (auto vfunc : priv->vfuncs)
-        gjs_closure_trace(vfunc->js_function, tracer);
 }
 
 static void
@@ -1486,10 +1479,6 @@ object_instance_finalize(JSFreeOp  *fop,
         release_native_object(priv);
     }
 
-    /* We have to leak the trampolines, since the GType's vtable still refers
-     * to them */
-    priv->vfuncs.clear();
-
     if (priv->keep_alive.rooted()) {
         /* This happens when the refcount on the object is still >1,
          * for example with global objects GDK never frees like GdkDisplay,
@@ -2318,7 +2307,6 @@ gjs_hook_up_vfunc(JSContext *cx,
                                                  object, true);
 
         *((ffi_closure **)method_ptr) = trampoline->closure;
-        priv->vfuncs.push_back(trampoline);
 
         g_base_info_unref(field_info);
     }


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