diff options
author | stanton <stanton> | 1998-12-01 05:01:01 (GMT) |
---|---|---|
committer | stanton <stanton> | 1998-12-01 05:01:01 (GMT) |
commit | e93d75d3f9c3d8584f674270fde377c0b90cfd8f (patch) | |
tree | fe6eed551aa4e0b1510edb2cf71cb5bceee5911a /generic/tclThread.c | |
parent | 159c2988058c79f38a3d820dbb5cea3f8b5abc34 (diff) | |
download | tcl-e93d75d3f9c3d8584f674270fde377c0b90cfd8f.zip tcl-e93d75d3f9c3d8584f674270fde377c0b90cfd8f.tar.gz tcl-e93d75d3f9c3d8584f674270fde377c0b90cfd8f.tar.bz2 |
* unix/tclUnixNotfy.c (Tcl_WaitForEvent): Fixed hang that occurs
when trying to close a pipe that is currently being waited on by
the notifier thread. [Bug: 607]
* unix/tclUnixFCmd.c (GetPermissionsAttribute): Increase size of
returnString buffer to avoid overflow.
* generic/tclThreadTest.c (TclThreadSend): Fixed memory leak due
to use of TCL_VOLATILE instead of TCL_DYNAMIC.
* generic/tclThread.c (TclRememberSyncObject): Fixed memory leak
caused by failure to reuse condition variables.
* unix/tclUnixNotfy.c: (Tcl_AlertNotifier, Tcl_WaitForEvent,
NotifierThreadProc, Tcl_InitNotifier): Fixed race condition caused
by incorrect use of condition variables when sending messages
between threads.. [Bug: 607]
* generic/tclTestObj.c (TeststringobjCmd): MAX_STRINGS was off by one
so the strings array was too small.
* generic/tclCkalloc.c (Tcl_DbCkfree): Moved mutex lock so
ValidateMemory is done inside the mutex to avoid a race condition
when validate_memory is enabled. [Bug: 880]
Diffstat (limited to 'generic/tclThread.c')
-rw-r--r-- | generic/tclThread.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/generic/tclThread.c b/generic/tclThread.c index 14bb1ba..cfadfb9 100644 --- a/generic/tclThread.c +++ b/generic/tclThread.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclThread.c,v 1.1.2.3 1998/11/11 04:54:20 stanton Exp $ + * RCS: @(#) $Id: tclThread.c,v 1.1.2.4 1998/12/01 05:01:02 stanton Exp $ */ #include "tclInt.h" @@ -225,23 +225,27 @@ TclRememberSyncObject(objPtr, recPtr) SyncObjRecord *recPtr; /* Record of sync objects */ { char **newList; - int i; + int i, j; /* * Save the pointer to the allocated object so it can be finalized. - * Grow the list of pointers if necessary. + * Grow the list of pointers if necessary, copying only non-NULL + * pointers to the new list. */ if (recPtr->num >= recPtr->max) { recPtr->max += 8; newList = (char **)ckalloc(recPtr->max * sizeof(char *)); - for (i=0 ; i<recPtr->num ; i++) { - newList[i] = recPtr->list[i]; + for (i=0,j=0 ; i<recPtr->num ; i++) { + if (recPtr->list[i] != NULL) { + newList[j++] = recPtr->list[i]; + } } if (recPtr->list != NULL) { ckfree((char *)recPtr->list); } recPtr->list = newList; + recPtr->num = j; } recPtr->list[recPtr->num] = objPtr; recPtr->num++; |