diff options
| author | dkf <donal.k.fellows@manchester.ac.uk> | 2024-07-21 14:14:42 (GMT) |
|---|---|---|
| committer | dkf <donal.k.fellows@manchester.ac.uk> | 2024-07-21 14:14:42 (GMT) |
| commit | b66dcfd46ed96ddfacaa74856ac4f09fb06a9b37 (patch) | |
| tree | 78f2bd68aea938cc3a56cd2c929819983451de7a /generic/tclOOBasic.c | |
| parent | ce7649530f21f52c43e065104e759a52f3ff1c6d (diff) | |
| download | tcl-b66dcfd46ed96ddfacaa74856ac4f09fb06a9b37.zip tcl-b66dcfd46ed96ddfacaa74856ac4f09fb06a9b37.tar.gz tcl-b66dcfd46ed96ddfacaa74856ac4f09fb06a9b37.tar.bz2 | |
Tidying up the properties code
Diffstat (limited to 'generic/tclOOBasic.c')
| -rw-r--r-- | generic/tclOOBasic.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index 34cc272..e8b4e13 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.c @@ -1678,8 +1678,9 @@ TclOO_Configurable_Configure( static int Configurable_Getter( - void *clientData, /* Which property to read. - * Actually a Tcl_Obj* reference. */ + void *clientData, /* Which property to read. Actually a Tcl_Obj* + * reference that is the name of the variable + * in the cpntext object. */ Tcl_Interp *interp, /* Interpreter used for the result, error * reporting, etc. */ Tcl_ObjectContext context, /* The object/call context. */ @@ -1713,8 +1714,9 @@ Configurable_Getter( static int Configurable_Setter( - void *clientData, /* Which property to write. - * Actually a Tcl_Obj* reference. */ + void *clientData, /* Which property to write. Actually a Tcl_Obj* + * reference that is the name of the variable + * in the cpntext object. */ Tcl_Interp *interp, /* Interpreter used for the result, error * reporting, etc. */ Tcl_ObjectContext context, /* The object/call context. */ @@ -1791,22 +1793,18 @@ TclOOImplementObjectProperty( if (installGetter) { Tcl_Obj *methodName = Tcl_ObjPrintf( "<ReadProp-%s>", TclGetString(propNamePtr)); - // Don't know if TclNewInstanceMethod will retain a ref to the method name - Tcl_IncrRefCount(methodName); Tcl_IncrRefCount(propNamePtr); // Paired with DetailsDeleter TclNewInstanceMethod( NULL, targetObject, methodName, 0, &GetterType, propNamePtr); - Tcl_DecrRefCount(methodName); + Tcl_BounceRefCount(methodName); } if (installSetter) { Tcl_Obj *methodName = Tcl_ObjPrintf( "<WriteProp-%s>", TclGetString(propNamePtr)); - // Don't know if TclNewInstanceMethod will retain a ref to the method name - Tcl_IncrRefCount(methodName); Tcl_IncrRefCount(propNamePtr); // Paired with DetailsDeleter TclNewInstanceMethod( NULL, targetObject, methodName, 0, &SetterType, propNamePtr); - Tcl_DecrRefCount(methodName); + Tcl_BounceRefCount(methodName); } } @@ -1820,22 +1818,18 @@ TclOOImplementClassProperty( if (installGetter) { Tcl_Obj *methodName = Tcl_ObjPrintf( "<ReadProp-%s>", TclGetString(propNamePtr)); - // Don't know if TclNewMethod will retain a ref to the method name - Tcl_IncrRefCount(methodName); Tcl_IncrRefCount(propNamePtr); // Paired with DetailsDeleter TclNewMethod( NULL, targetClass, methodName, 0, &GetterType, propNamePtr); - Tcl_DecrRefCount(methodName); + Tcl_BounceRefCount(methodName); } if (installSetter) { Tcl_Obj *methodName = Tcl_ObjPrintf( "<WriteProp-%s>", TclGetString(propNamePtr)); - // Don't know if TclNewMethod will retain a ref to the method name - Tcl_IncrRefCount(methodName); Tcl_IncrRefCount(propNamePtr); // Paired with DetailsDeleter TclNewMethod( NULL, targetClass, methodName, 0, &SetterType, propNamePtr); - Tcl_DecrRefCount(methodName); + Tcl_BounceRefCount(methodName); } } |
