Tcl Source Code

Check-in [b7ca02496d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:restore refcounts as they were before the Tcl_ListObjReplace call, in the error situation. In Tcl9, make this a true Tcl_DecrRefCount, which properly cleans objects with refCount 0
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: b7ca02496d4914cbdb4604ea8c440e9b8d1ccaf4
User & Date: jan.nijtmans 2012-12-29 09:16:43
Context
2013-01-02
14:30
test Tcl_GetErrorLine() forwards/backwards compatibility in pkgb.so as well. Marked some string sub... check-in: 06271b0e07 user: jan.nijtmans tags: core-8-5-branch
2012-12-29
09:23
restore refcounts as they were before the Tcl_ListObjReplace call, in the error situation. In Tcl9,... check-in: f83c3f4bad user: jan.nijtmans tags: trunk
09:16
restore refcounts as they were before the Tcl_ListObjReplace call, in the error situation. In Tcl9, ... check-in: b7ca02496d user: jan.nijtmans tags: core-8-5-branch
00:06
For Tcl9, do a real Tcl_DecrRefCount Closed-Leaf check-in: 450c192395 user: jan.nijtmans tags: bug-3598580
2012-12-27
14:57
[Bug 3598580]: Tcl_ListObjReplace may release deleted elements too early check-in: 6d560f6812 user: jan.nijtmans tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclListObj.c.

902
903
904
905
906
907
908








909
910
911
912
913
914
915
	    newMax = 2 * numRequired;
	} else {
	    newMax = listRepPtr->maxElemCount;
	}

	listRepPtr = AttemptNewList(interp, newMax, NULL);
	if (listRepPtr == NULL) {








	    return TCL_ERROR;
	}

	listPtr->internalRep.twoPtrValue.ptr1 = (void *) listRepPtr;
	listRepPtr->refCount++;

	elemPtrs = &listRepPtr->elements;







>
>
>
>
>
>
>
>







902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
	    newMax = 2 * numRequired;
	} else {
	    newMax = listRepPtr->maxElemCount;
	}

	listRepPtr = AttemptNewList(interp, newMax, NULL);
	if (listRepPtr == NULL) {
	    for (i = 0;  i < objc;  i++) {
		/* See bug 3598580 */
#if TCL_MAJOR_VERSION > 8
		Tcl_DecrRefCount(objv[i]);
#else
		objv[i]->refCount--;
#endif
	    }
	    return TCL_ERROR;
	}

	listPtr->internalRep.twoPtrValue.ptr1 = (void *) listRepPtr;
	listRepPtr->refCount++;

	elemPtrs = &listRepPtr->elements;