From 2eeeebf715bab6f9b11e25228bd3fce8f4b3ee0a Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Tue, 11 Feb 2025 18:52:24 +0100 Subject: [PATCH] avoid calling Tcl_GetErrorLine() if tcl version < 8.6 --- src/xinit.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/xinit.c b/src/xinit.c index 0ee4bca2..9db98f91 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -1174,12 +1174,27 @@ static int source_tcl_file(char *s) if(Tcl_EvalFile(interp, s)==TCL_ERROR) { fprintf(errfp, "Tcl_AppInit() error: can not execute %s, please fix:\n", s); + + + + #if TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >=6 fprintf(errfp, "Line No: %d\n", Tcl_GetErrorLine(interp)); + #endif + + + fprintf(errfp, "%s", tclresult()); fprintf(errfp, "\n"); + + #if TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >=6 my_snprintf(tmp, S(tmp), "tk_messageBox -icon error -type ok -message \ {Tcl_AppInit() err 1: can not execute %s, please fix:\n%s\nLine No: %d\n}", s, tclresult(), Tcl_GetErrorLine(interp)); + #else + my_snprintf(tmp, S(tmp), "tk_messageBox -icon error -type ok -message \ + {Tcl_AppInit() err 1: can not execute %s, please fix:\n%s\n}", + s, tclresult()); + #endif if(has_x) { tcleval( "wm withdraw ."); tcleval( tmp);