From 0101865f6215347bc61daa8970fbf08bebf97c1b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 15 Jan 2013 22:21:03 +0000 Subject: don't crash if Tcl_FindExecutable cannot be called don't compile with TCL_NO_DEPRECATED (otherwise Tcl_[GS]etStartupScript could be taken from the public stub table with Tcl 8.6) --- generic/tk.h | 2 +- generic/tkMain.c | 8 ++++++-- unix/Makefile.in | 2 +- win/Makefile.in | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/generic/tk.h b/generic/tk.h index b275018..63639fc 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -1520,7 +1520,7 @@ typedef struct Tk_ElementSpec { #define Tk_Release Tcl_Release /* Removed Tk_Main, use macro instead - * Starting with Tcl 8.6, Tcl_FindExecutable must be called first. + * Preferably, Tcl_FindExecutable is called first (mandatory for Tcl >= 8.6). */ #if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6) #define Tk_Main(argc, argv, proc) \ diff --git a/generic/tkMain.c b/generic/tkMain.c index e95f7a3..b2496d8 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -26,8 +26,12 @@ extern int TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *); -#if TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 5 -# define Tcl_FindExecutable(argv0) /* not needed for Tcl > 8.5 */ +#if TCL_MAJOR_VERSION > 8 +# define Tcl_FindExecutable(argv0) /* not needed for Tcl >= 9.0 */ +#elif defined(USE_TCL_STUBS) /* Only call if non-NULL */ +# undef Tcl_FindExecutable +# define Tcl_FindExecutable(argv0) if (tclStubsPtr->tcl_FindExecutable) \ + tclStubsPtr->tcl_FindExecutable(argv0) #endif typedef struct ThreadSpecificData { diff --git a/unix/Makefile.in b/unix/Makefile.in index aa4e255..1da2d72 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -186,7 +186,7 @@ KEYSYM_FLAGS = # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. -NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED +NO_DEPRECATED_FLAGS = #NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED # Some versions of make, like SGI's, use the following variable to diff --git a/win/Makefile.in b/win/Makefile.in index 24217be..550e6ae 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -163,7 +163,7 @@ LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. -NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED +NO_DEPRECATED_FLAGS = #NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED # To change the compiler switches, for example to change from optimization to -- cgit v0.12