Tcl Source Code

Check-in [5f178e7f03]
Login

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

Overview
Comment:Fix bug 3c32a3f8bd, segmentation fault in TclOO.c/ReleaseClassContents() for a class mixed into one of its instances.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5f178e7f03620adce3285b358abb631d897a07f32192f3825cce6fa7f3195408
User & Date: pooryorick 2017-11-01 21:05:32.144
References
2017-11-17
23:06 Closed ticket [3c32a3f8bd]: TclOO - mixing an object plus 5 other changes artifact: 43d1bf64af user: pooryorick
Context
2018-02-14
12:14
Fix bug 3c32a3f8bd, segmentation fault in TclOO.c/ReleaseClassContents() for a class mixed into one ... check-in: d021c547ea user: pooryorick tags: core-8-6-branch
2017-11-01
22:21
Unit test for issue 3c32a3f8bd, Segmentation fault in TclOO.c/ReleaseClassContents() for a class mix... check-in: 2bdec8b46d user: pooryorick tags: trunk
21:05
Fix bug 3c32a3f8bd, segmentation fault in TclOO.c/ReleaseClassContents() for a class mixed into one ... check-in: 5f178e7f03 user: pooryorick tags: trunk
2017-10-30
05:25
merge bug-fc1409fc91. check-in: 76eaf9a16b user: pooryorick tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/tclOO.c.
1002
1003
1004
1005
1006
1007
1008

1009





1010




1011
1012
1013
1014
1015
1016
1017
	FOREACH(instancePtr, clsPtr->instances) {
	    int j;
	    if (instancePtr->selfCls == clsPtr) {
		instancePtr->flags |= CLASS_GONE;
	    }
	    for(j=0 ; j<instancePtr->mixins.num ; j++) {
		Class *mixin = instancePtr->mixins.list[j];

		if (mixin == clsPtr) {





		    instancePtr->mixins.list[j] = NULL;




		}
	    }
	    if (instancePtr != NULL && !IsRoot(instancePtr)) {
		AddRef(instancePtr);
	    }
	}
    }







>

>
>
>
>
>
|
>
>
>
>







1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
	FOREACH(instancePtr, clsPtr->instances) {
	    int j;
	    if (instancePtr->selfCls == clsPtr) {
		instancePtr->flags |= CLASS_GONE;
	    }
	    for(j=0 ; j<instancePtr->mixins.num ; j++) {
		Class *mixin = instancePtr->mixins.list[j];
		Class *nextMixin = NULL;
		if (mixin == clsPtr) {
		    if (j < instancePtr->mixins.num - 1) {
			nextMixin = instancePtr->mixins.list[j+1];
		    }
		    if (j == 0) {
			instancePtr->mixins.num = 0;
			instancePtr->mixins.list = NULL;
		    } else {
			instancePtr->mixins.list[j-1] = nextMixin;
		    }
		    instancePtr->mixins.num -= 1;
		}
	    }
	    if (instancePtr != NULL && !IsRoot(instancePtr)) {
		AddRef(instancePtr);
	    }
	}
    }
1177
1178
1179
1180
1181
1182
1183
1184

1185
1186
1187
1188
1189
1190
1191
     * point into freed memory, allowing crashes.
     */

    if (oPtr->command) {
	if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) {
	    /*
	     * Namespace deletion must have been triggered by a trace on command
	     * deletion , meaning that 

	     */
	    deleteAlreadyInProgress = 1;
	}

	Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command);
    }
    if (oPtr->myCommand) {







|
>







1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
     * point into freed memory, allowing crashes.
     */

    if (oPtr->command) {
	if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) {
	    /*
	     * Namespace deletion must have been triggered by a trace on command
	     * deletion , meaning that ObjectRenamedTrace() is eventually going
	     * to be called .
	     */
	    deleteAlreadyInProgress = 1;
	}

	Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command);
    }
    if (oPtr->myCommand) {