[gnode] gobject: Fix issues with multiple instances



commit da3c269112d40ffb031c56d1a4813baabfe4f32e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Nov 27 16:49:50 2015 -0800

    gobject: Fix issues with multiple instances
    
    It seems that the slot will be carried across all instances if it's part
    of the inherited template. Oops.

 src/gobject.cc |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/gobject.cc b/src/gobject.cc
index f54b7ed..b1aca4a 100644
--- a/src/gobject.cc
+++ b/src/gobject.cc
@@ -194,8 +194,6 @@ static Handle<Value> SignalConnect(const Arguments &args) {
 
 static Handle<FunctionTemplate> GetBaseClassTemplate() {
     Local<FunctionTemplate> tpl = FunctionTemplate::New ();
-    tpl->InstanceTemplate ()->SetInternalFieldCount (1);
-
     Handle<ObjectTemplate> proto = tpl->PrototypeTemplate ();
     proto->Set (String::NewSymbol ("connect"), FunctionTemplate::New (SignalConnect)->GetFunction ());
 
@@ -228,6 +226,8 @@ static Handle<FunctionTemplate> GetClassTemplate(GIBaseInfo *info, GType gtype)
             tpl->Inherit (GetBaseClassTemplate ());
         }
 
+        tpl->InstanceTemplate ()->SetInternalFieldCount (1);
+
         DefineConstructorMethods (tpl, info);
         DefinePrototypeMethods (tpl->PrototypeTemplate (), info);
 


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