[gnode] gobject: Fix up inheritance and such



commit e7ec52d5037ea762f5aee63781466ea87ddfe227
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Nov 27 13:06:31 2015 -0800

    gobject: Fix up inheritance and such
    
    We can't call GetFunction, since that solidifies the
    template. Additionally, use the PrototypeTemplate, not the
    InstanceTemplate, to ensure that inheritance works.

 src/gobject.cc |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/gobject.cc b/src/gobject.cc
index fa632ae..e7e578f 100644
--- a/src/gobject.cc
+++ b/src/gobject.cc
@@ -144,7 +144,7 @@ static void ClassDestroyed(Persistent<Value> object, void *data) {
     g_base_info_unref (info);
 }
 
-static void DefineConstructorMethods(Handle<Object> constructor, GIBaseInfo *info) {
+static void DefineConstructorMethods(Handle<FunctionTemplate> constructor, GIBaseInfo *info) {
     int n_methods = g_object_info_get_n_methods (info);
     for (int i = 0; i < n_methods; i++) {
         GIFunctionInfo *meth_info = g_object_info_get_method (info, i);
@@ -200,11 +200,10 @@ static Handle<FunctionTemplate> GetClassTemplate(GIBaseInfo *info, GType gtype)
             tpl->Inherit (parent_tpl);
         }
 
-        DefineConstructorMethods (tpl->GetFunction (), info);
-        DefinePrototypeMethods (tpl->InstanceTemplate (), info);
+        DefineConstructorMethods (tpl, info);
+        DefinePrototypeMethods (tpl->PrototypeTemplate (), info);
 
-        Handle<ObjectTemplate> inst_tpl = tpl->InstanceTemplate ();
-        inst_tpl->SetInternalFieldCount (1);
+        tpl->InstanceTemplate ()->SetInternalFieldCount (1);
 
         return tpl;
     }


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