Tcl Source Code

Check-in [ef02e1dfd9]
Login

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

Overview
Comment:Make tweak to the mem-debug tracking official. It is now again possible to use regular packages with a mem-debug core without inciting a panic.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ef02e1dfd92a04054f9ae123fe7e498f793963ff
User & Date: andreask 2015-05-27 18:35:46.453
Context
2015-06-03
12:26
[268b23df11] When GetSrcInfoForPc() returns NULL, make sure it also sets the length to a non-positiv... check-in: 5bd1e43691 user: dgp tags: trunk
2015-05-31
16:20
merge trunk check-in: 5a33b96277 user: oehhar tags: msgcat_dyn_locale
2015-05-28
12:28
merge trunk check-in: 8f95dbfde4 user: dgp tags: bug-57945b574a
2015-05-27
21:11
Merge trunk check-in: f5d3bd2653 user: jan.nijtmans tags: novem
18:35
Make tweak to the mem-debug tracking official. It is now again possible to use regular packages with... check-in: ef02e1dfd9 user: andreask tags: trunk
18:25
Make tweak to the mem-debug tracking official. It is now again possible to use regular packages with... check-in: 38ddcfe658 user: andreask tags: core-8-5-branch
2015-05-26
10:16
Added missing marker for incompatibility. check-in: ffbbbcc0ed user: dkf tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/tclObj.c.
1297
1298
1299
1300
1301
1302
1303

































1304
1305
1306
1307
1308
1309
1310

    /*
     * This macro declares a variable, so must come here...
     */

    ObjInitDeletionContext(context);


































    /*
     * Check for a double free of the same value.  This is slightly tricky
     * because it is customary to free a Tcl_Obj when its refcount falls
     * either from 1 to 0, or from 0 to -1.  Falling from -1 to -2, though,
     * and so on, is always a sign of a botch in the caller.
     */
    if (objPtr->refCount < -1) {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343

    /*
     * This macro declares a variable, so must come here...
     */

    ObjInitDeletionContext(context);

# ifdef TCL_THREADS
    /*
     * Check to make sure that the Tcl_Obj was allocated by the current
     * thread. Don't do this check when shutting down since thread local
     * storage can be finalized before the last Tcl_Obj is freed.
     */

    if (!TclInExit()) {
	Tcl_HashTable *tablePtr;
	Tcl_HashEntry *hPtr;
	ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);

	tablePtr = tsdPtr->objThreadMap;
	if (!tablePtr) {
	    Tcl_Panic("TclFreeObj: object table not initialized");
	}
	hPtr = Tcl_FindHashEntry(tablePtr, (char *) objPtr);
	if (hPtr) {
	    /*
	     * As the Tcl_Obj is going to be deleted we remove the entry.
	     */

	    ObjData *objData = Tcl_GetHashValue(hPtr);

	    if (objData != NULL) {
		ckfree(objData);
	    }

	    Tcl_DeleteHashEntry(hPtr);
	}
    }
# endif

    /*
     * Check for a double free of the same value.  This is slightly tricky
     * because it is customary to free a Tcl_Obj when its refcount falls
     * either from 1 to 0, or from 0 to -1.  Falling from -1 to -2, though,
     * and so on, is always a sign of a botch in the caller.
     */
    if (objPtr->refCount < -1) {
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
	    Tcl_Panic("object table not initialized");
	}
	hPtr = Tcl_FindHashEntry(tablePtr, objPtr);
	if (!hPtr) {
	    Tcl_Panic("Trying to %s of Tcl_Obj allocated in another thread",
                    "decr ref count");
	}

	/*
	 * If the Tcl_Obj is going to be deleted, remove the entry.
	 */

	if ((objPtr->refCount - 1) <= 0) {
	    ObjData *objData = Tcl_GetHashValue(hPtr);

	    if (objData != NULL) {
		ckfree(objData);
	    }

	    Tcl_DeleteHashEntry(hPtr);
	}
    }
# endif /* TCL_THREADS */
#endif /* TCL_MEM_DEBUG */

    if (--(objPtr)->refCount <= 0) {
	TclFreeObj(objPtr);
    }







<
<
<
<
<
<
<
<
<
<
<
<
<
<







3795
3796
3797
3798
3799
3800
3801














3802
3803
3804
3805
3806
3807
3808
	    Tcl_Panic("object table not initialized");
	}
	hPtr = Tcl_FindHashEntry(tablePtr, objPtr);
	if (!hPtr) {
	    Tcl_Panic("Trying to %s of Tcl_Obj allocated in another thread",
                    "decr ref count");
	}














    }
# endif /* TCL_THREADS */
#endif /* TCL_MEM_DEBUG */

    if (--(objPtr)->refCount <= 0) {
	TclFreeObj(objPtr);
    }