summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--generic/tclEvent.c13
-rw-r--r--generic/tclIOUtil.c19
3 files changed, 22 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 5125517..b76ab35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,8 @@
* generic/tclIOUtil.c:
* generic/tclInt.h: clean up all memory allocated by the
filesystem, via introduction of 'TclFinalizeFilesystem'.
+ Move TclFinalizeLoad into TclFinalizeFilesystem so we can
+ be sure it is called at just the right time.
Fix bad comment also. [Fixes 555078 and 'fs' part of 543549]
* win/tclWinChan.c: fix comment referring to wrong function.
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index 6d16bf7..4f0ec61 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclEvent.c,v 1.21 2002/05/13 13:20:00 vincentdarley Exp $
+ * RCS: @(#) $Id: tclEvent.c,v 1.22 2002/05/14 09:44:43 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -836,17 +836,10 @@ Tcl_Finalize()
TclFinalizeSynchronization();
- /*
- * We defer unloading of packages until very late
- * to avoid memory access issues. Both exit callbacks and
- * synchronization variables may be stored in packages.
- */
-
- TclFinalizeLoad();
-
/**
* Finalizing the filesystem must come after anything which
- * might conceivably interact with the 'Tcl_FS' API.
+ * might conceivably interact with the 'Tcl_FS' API. This
+ * will also unload any extensions which have been loaded.
*/
TclFinalizeFilesystem();
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 27df363..4b949f8 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -17,7 +17,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIOUtil.c,v 1.43 2002/05/13 13:20:00 vincentdarley Exp $
+ * RCS: @(#) $Id: tclIOUtil.c,v 1.44 2002/05/14 09:44:43 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -561,12 +561,19 @@ FsReleaseIterator(void) {
*
* Clean up the filesystem. After this, calls to all Tcl_FS...
* functions will fail.
+ *
+ * Note that, since 'TclFinalizedLoad' may unload extensions
+ * which implement other filesystems, and which may therefore
+ * contain a 'freeProc' for those filesystems, at this stage
+ * we _must_ have freed all objects of "path" type, or we may
+ * end up with segfaults if we try to free them later.
*
* Results:
* None.
*
* Side effects:
- * Frees any memory allocated by the filesystem.
+ * Frees any memory allocated by the filesystem. Unloads any
+ * extensions which have been loaded.
*
*----------------------------------------------------------------------
*/
@@ -583,6 +590,14 @@ TclFinalizeFilesystem() {
cwdPathPtr = NULL;
}
+ /*
+ * We defer unloading of packages until very late
+ * to avoid memory access issues. Both exit callbacks and
+ * synchronization variables may be stored in packages.
+ */
+
+ TclFinalizeLoad();
+
/* Remove all filesystems, freeing any allocated memory */
while (filesystemList != NULL) {
FilesystemRecord *tmpFsRecPtr = filesystemList->nextPtr;