From 242ca27e8759537c7fe5c640c66084aee13fc51f Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 28 Sep 2005 18:31:57 +0000 Subject: * unix/tkUnixPort.h: Disabled inclusion of the private Tcl header * win/tkWinPort.h: file tclInt.h. Tk ought to have a tiny and shrinking number of calls of private Tcl routines. Each Tk source file doing this should follow the convention in the macosx port and have its own #include "tclInt.h". * generic/tkEvent.c: Disabled calls to private Tcl routine TclInExit(). See comment in TkCreateExitHandler() for full rationale. --- ChangeLog | 11 +++++++++++ generic/tkEvent.c | 26 +++++++++++++++++++++++--- unix/tkUnixPort.h | 6 ++++-- win/tkWinPort.h | 7 ++++++- 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b2496b6..7e04300 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2005-09-28 Don Porter + + * unix/tkUnixPort.h: Disabled inclusion of the private Tcl header + * win/tkWinPort.h: file tclInt.h. Tk ought to have a tiny and + shrinking number of calls of private Tcl routines. Each Tk source + file doing this should follow the convention in the macosx port and + have its own #include "tclInt.h". + + * generic/tkEvent.c: Disabled calls to private Tcl routine + TclInExit(). See comment in TkCreateExitHandler() for full rationale. + 2005-09-21 Donal K. Fellows * generic/tkEvent.c (TkCreateThreadExitHandler, TkFinalizeThread) diff --git a/generic/tkEvent.c b/generic/tkEvent.c index fa81b65..ceffd0a 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEvent.c,v 1.29 2005/09/21 10:54:40 dkf Exp $ + * RCS: @(#) $Id: tkEvent.c,v 1.30 2005/09/28 18:31:57 dgp Exp $ */ #include "tkPort.h" @@ -1880,7 +1880,26 @@ TkCreateExitHandler( exitPtr->proc = proc; exitPtr->clientData = clientData; Tcl_MutexLock(&exitMutex); - if (firstExitPtr == NULL && !TclInExit()) { + + /* + * The call to TclInExit() is disabled here. That's a private + * Tcl routine, and calling it is causing some trouble with portability + * of building Tk. We should avoid private Tcl routines generally. + * + * In this case, the TclInExit() call is being used only to prevent + * a Tcl_CreateExitHandler() call when Tcl finalization is in progress. + * That's a situation that shouldn't happen anyway. Recent changes + * within Tcl_Finalize now cause a Tcl_Panic() to happen if exit + * handlers get added after exit handling is complete. By disabling + * the guard here, that panic will serve to help us find the buggy + * conditions and correct them. + * + * We can restore this guard if we find we must (hopefully getting + * public access to TclInExit() if we discover extensions really do + * need this), but during alpha development, this is a good time to + * dig in and find the root causes of finalization bugs. + */ + if (firstExitPtr == NULL/* && !TclInExit()*/) { Tcl_CreateExitHandler(TkFinalize, NULL); } exitPtr->nextPtr = firstExitPtr; @@ -1958,7 +1977,8 @@ TkCreateThreadExitHandler( exitPtr = (ExitHandler *) ckalloc(sizeof(ExitHandler)); exitPtr->proc = proc; exitPtr->clientData = clientData; - if (tsdPtr->firstExitPtr == NULL && !TclInExit()) { + /* See comments in TkCreateExitHandler */ + if (tsdPtr->firstExitPtr == NULL/* && !TclInExit()*/) { Tcl_CreateThreadExitHandler(TkFinalizeThread, NULL); } exitPtr->nextPtr = tsdPtr->firstExitPtr; diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h index d65f7f2..bdb6340 100644 --- a/unix/tkUnixPort.h +++ b/unix/tkUnixPort.h @@ -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: tkUnixPort.h,v 1.9 2003/10/14 23:11:03 jenglish Exp $ + * RCS: @(#) $Id: tkUnixPort.h,v 1.10 2005/09/28 18:31:57 dgp Exp $ */ #ifndef _UNIXPORT @@ -218,10 +218,12 @@ extern int errno; /* * The following declaration is used to get access to a private Tcl interface * that is needed for portability reasons. - */ + * + * Disabled for now to determined whether we really still need this. #ifndef _TCLINT #include #endif + */ #endif /* _UNIXPORT */ diff --git a/win/tkWinPort.h b/win/tkWinPort.h index 4eaec99..cb8def1 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinPort.h,v 1.9 2002/10/19 02:10:20 hobbs Exp $ + * RCS: @(#) $Id: tkWinPort.h,v 1.10 2005/09/28 18:31:57 dgp Exp $ */ #ifndef _WINPORT @@ -128,8 +128,13 @@ struct timezone { int tz_dsttime; }; +/* + * Disabled inclusion of Tcl's private header in hope of discovering we + * no longer need it. + * #ifndef _TCLINT #include #endif + */ #endif /* _WINPORT */ -- cgit v0.12