Tcl Source Code

Check-in [f83c3f4bad]
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 | trunk
Files: files | file ages | folders
SHA1: f83c3f4bad42406bed12f2c0a9de4ea6a0aaf145
User & Date: jan.nijtmans 2012-12-29 09:23:24
Context
2012-12-31
12:32
Marked some string subcommands as obsolete, following discussion on tcl-core. check-in: 1a460ac0d3 user: dkf tags: trunk
2012-12-29
09:24
merge trunk check-in: d53d72ddfb user: jan.nijtmans tags: novem
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
2012-12-27
15:04
[Bug 3598580]: Tcl_ListObjReplace may release deleted elements too early check-in: 4865e19aac user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclListObj.c.

963
964
965
966
967
968
969








970
971
972
973
974
975
976
		    + TCL_MIN_ELEMENT_GROWTH;
	    int growth = (int) ((extra > limit) ? limit : extra);

	    listRepPtr = AttemptNewList(NULL, numRequired + growth, NULL);
	    if (listRepPtr == NULL) {
		listRepPtr = AttemptNewList(interp, numRequired, NULL);
		if (listRepPtr == NULL) {








		    return TCL_ERROR;
		}
	    }
	}

	listPtr->internalRep.twoPtrValue.ptr1 = listRepPtr;
	listRepPtr->refCount++;







>
>
>
>
>
>
>
>







963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
		    + TCL_MIN_ELEMENT_GROWTH;
	    int growth = (int) ((extra > limit) ? limit : extra);

	    listRepPtr = AttemptNewList(NULL, numRequired + growth, NULL);
	    if (listRepPtr == NULL) {
		listRepPtr = AttemptNewList(interp, numRequired, 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 = listRepPtr;
	listRepPtr->refCount++;