diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-08-14 10:53:39 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-08-14 10:53:39 (GMT) |
commit | 68419d2d6bedf1ae539fbdd80c50eff66b90e883 (patch) | |
tree | c94eb9ac635555edd735af8a8e6f8f7fddb363fe /generic | |
parent | 659e373aa07b9b9edde1a077fdde98b1c7cc5816 (diff) | |
download | tk-68419d2d6bedf1ae539fbdd80c50eff66b90e883.zip tk-68419d2d6bedf1ae539fbdd80c50eff66b90e883.tar.gz tk-68419d2d6bedf1ae539fbdd80c50eff66b90e883.tar.bz2 |
Fix reference counting for "option" objects, when being duplicated.bug_069c9e43c4
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkConfig.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/generic/tkConfig.c b/generic/tkConfig.c index cfa5003..82b2e01 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -129,6 +129,7 @@ static Option * GetOptionFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, OptionTable *tablePtr); static int ObjectIsEmpty(Tcl_Obj *objPtr); static void FreeOptionInternalRep(Tcl_Obj *objPtr); +static void DupOptionInternalRep(Tcl_Obj *, Tcl_Obj *); /* * The structure below defines an object type that is used to cache the result @@ -140,7 +141,7 @@ static void FreeOptionInternalRep(Tcl_Obj *objPtr); static const Tcl_ObjType optionObjType = { "option", /* name */ FreeOptionInternalRep, /* freeIntRepProc */ - NULL, /* dupIntRepProc */ + DupOptionInternalRep, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL /* setFromAnyProc */ }; @@ -1172,6 +1173,28 @@ FreeOptionInternalRep( objPtr->internalRep.twoPtrValue.ptr1 = NULL; objPtr->internalRep.twoPtrValue.ptr2 = NULL; } + +/* + *--------------------------------------------------------------------------- + * + * DupOptionInternalRep -- + * + * When a cached style object is duplicated, this is called to update the + * internal reps. + * + *--------------------------------------------------------------------------- + */ + +static void +DupOptionInternalRep( + Tcl_Obj *srcObjPtr, /* The object we are copying from. */ + Tcl_Obj *dupObjPtr) /* The object we are copying to. */ +{ + register OptionTable *tablePtr = (OptionTable *) srcObjPtr->internalRep.twoPtrValue.ptr1; + tablePtr->refCount++; + dupObjPtr->typePtr = srcObjPtr->typePtr; + dupObjPtr->internalRep = srcObjPtr->internalRep; +} /* *-------------------------------------------------------------- |