From f9b9d749cefde03a0e20c3fe82fd51cb3298e0f0 Mon Sep 17 00:00:00 2001
From: hobbs <hobbs>
Date: Sat, 25 Jan 2003 03:12:00 +0000
Subject: 	* generic/tclEvent.c (Tcl_Finalize): revert finalize change on
 	2002-12-04 to correct the issue with extensions that have TSD 
 needing to finalize that before they are unloaded.  This issue 	needs
 further clarification.

---
 ChangeLog          |  8 ++++++++
 generic/tclEvent.c | 30 +++++++++++++++++++-----------
 2 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 34e9358..4b3fa79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2003-01-24  Jeff Hobbs  <jeffh@ActiveState.com>
 
+	* win/tclWinDde.c (Dde_Init): clarified use of tsdPtr.
+	(DdeServerProc): better refcount handling of returnPackagePtr.
+
+	* generic/tclEvent.c (Tcl_Finalize): revert finalize change on
+	2002-12-04 to correct the issue with extensions that have TSD
+	needing to finalize that before they are unloaded.  This issue
+	needs further clarification.
+
 	* tests/unixFCmd.test: only do groups check on unix
 
 2003-01-24  Vince Darley  <vincentdarley@users.sourceforge.net>
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index 28b3489..f56c61d 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.25 2002/12/04 13:09:23 vincentdarley Exp $
+ * RCS: @(#) $Id: tclEvent.c,v 1.26 2003/01/25 03:12:01 hobbs Exp $
  */
 
 #include "tclInt.h"
@@ -812,16 +812,6 @@ Tcl_Finalize()
 	TclFinalizeCompExecEnv();
 	TclFinalizeEnvironment();
 
-	/*
-	 * Finalizing the filesystem must come after anything which
-	 * might conceivably interact with the 'Tcl_FS' API.  This
-	 * will also unload any extensions which have been loaded.
-	 * However, it also needs access to the encoding subsystem
-	 * during finalization, so that system must still be intact
-	 * at this point.
-	 */
-	TclFinalizeFilesystem();
-
 	/* 
 	 * We must be sure the encoding finalization doesn't need
 	 * to examine the filesystem in any way.  Since it only
@@ -853,6 +843,24 @@ Tcl_Finalize()
 	TclFinalizeSynchronization();
 
 	/*
+	 * FIX FIX FIX:
+	 * There is a conflict here between what apps need when for
+	 * finalization.  There is the encoding note below that
+	 * relates to tclkits, but there is the clear problem in a
+	 * standard threaded build that you must finalize the sync
+	 * objects before the filesystem to handle tsdPtr's in
+	 * extensions (example: dde).  -- hobbs
+	 * 
+	 * Finalizing the filesystem must come after anything which
+	 * might conceivably interact with the 'Tcl_FS' API.  This
+	 * will also unload any extensions which have been loaded.
+	 * However, it also needs access to the encoding subsystem
+	 * during finalization, so that system must still be intact
+	 * at this point.
+	 */
+	TclFinalizeFilesystem();
+
+	/*
 	 * There shouldn't be any malloc'ed memory after this.
 	 */
 
-- 
cgit v0.12