summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-11-22 11:59:04 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-11-22 11:59:04 (GMT)
commit00e7db48f071fe5c9fb63e4fa98af91f765948fe (patch)
tree6324655727a7fa434f6b0168097c7f77e19f31ec
parent0413253535483006c8686520a48238a8983fa3a5 (diff)
downloadtk-00e7db48f071fe5c9fb63e4fa98af91f765948fe.zip
tk-00e7db48f071fe5c9fb63e4fa98af91f765948fe.tar.gz
tk-00e7db48f071fe5c9fb63e4fa98af91f765948fe.tar.bz2
Fix [Bug 1151523] the non-embarrasing way!
-rw-r--r--ChangeLog5
-rw-r--r--doc/GetFont.37
-rw-r--r--generic/tkFont.c22
3 files changed, 23 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index cb66b7b..9d50a81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2005-11-22 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+ * doc/GetFont.3: Revert previous fix; a NULL interp is now legal.
+ * generic/tkFont.c (ParseFontNameObj, GetAttributeInfoObj): Allow
+ these functions to work with a NULL interp by making them check when
+ generating error messages. [Bug 1151523]
+
* library/tkfbox.tcl (::tk::dialog::file::): Correct the quoting of
the script used in variable traces so that widget names with spaces in
will work. [Bug 1335485]
diff --git a/doc/GetFont.3 b/doc/GetFont.3
index 7ac8429..d344b1e 100644
--- a/doc/GetFont.3
+++ b/doc/GetFont.3
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: GetFont.3,v 1.7 2005/08/18 18:41:18 dkf Exp $
+'\" RCS: @(#) $Id: GetFont.3,v 1.8 2005/11/22 11:59:04 dkf Exp $
'\"
.so man.macros
.TH Tk_AllocFontFromObj 3 8.1 Tk "Tk Library Procedures"
@@ -37,7 +37,8 @@ void
.SH ARGUMENTS
.AS "const char" *tkfont
.AP "Tcl_Interp" *interp in
-Interpreter to use for error reporting. Must not be NULL.
+Interpreter to use for error reporting. If \fBNULL\fR, then no error
+messages are left after errors.
.AP Tk_Window tkwin in
Token for window in which font will be used.
.AP Tcl_Obj *objPtr in/out
@@ -63,7 +64,7 @@ the documentation for the \fBfont\fR command for a description of the
valid formats. If \fBTk_AllocFontFromObj\fR is unsuccessful (because,
for example, \fIobjPtr\fR did not contain a valid font specification) then it
returns \fBNULL\fR and leaves an error message in \fIinterp\fR's result
-if \fIinterp\fR isn't NULL. \fBTk_AllocFontFromObj\fR caches
+if \fIinterp\fR isn't \fBNULL\fR. \fBTk_AllocFontFromObj\fR caches
information about the return
value in \fIobjPtr\fR, which speeds up future calls to procedures
such as \fBTk_AllocFontFromObj\fR and \fBTk_GetFontFromObj\fR.
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 3316bf3..cff54b0 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -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: tkFont.c,v 1.25 2005/11/17 10:57:35 dkf Exp $
+ * RCS: @(#) $Id: tkFont.c,v 1.26 2005/11/22 11:59:04 dkf Exp $
*/
#include "tkPort.h"
@@ -2893,8 +2893,10 @@ ConfigAttributesObj(
* bad option, rather than that the value for "-xyz" is missing.
*/
- Tcl_AppendResult(interp, "value for \"",
- Tcl_GetString(optionPtr), "\" option missing", NULL);
+ if (interp != NULL) {
+ Tcl_AppendResult(interp, "value for \"",
+ Tcl_GetString(optionPtr), "\" option missing", NULL);
+ }
return TCL_ERROR;
}
@@ -3056,8 +3058,7 @@ GetAttributeInfoObj(
static int
ParseFontNameObj(
- Tcl_Interp *interp, /* Interp for error return. Must not be
- * NULL. */
+ Tcl_Interp *interp, /* Interp for error return. */
Tk_Window tkwin, /* For display on which font is used. */
Tcl_Obj *objPtr, /* Parseable font description object. */
TkFontAttributes *faPtr) /* Filled with attributes parsed from font
@@ -3119,7 +3120,10 @@ ParseFontNameObj(
if ((Tcl_ListObjGetElements(NULL, objPtr, &objc, &objv) != TCL_OK)
|| (objc < 1)) {
- Tcl_AppendResult(interp, "font \"", string, "\" doesn't exist", NULL);
+ if (interp != NULL) {
+ Tcl_AppendResult(interp, "font \"", string, "\" doesn't exist",
+ NULL);
+ }
return TCL_ERROR;
}
@@ -3164,8 +3168,10 @@ ParseFontNameObj(
* Unknown style.
*/
- Tcl_AppendResult(interp, "unknown font style \"",
- Tcl_GetString(objv[i]), "\"", NULL);
+ if (interp != NULL) {
+ Tcl_AppendResult(interp, "unknown font style \"",
+ Tcl_GetString(objv[i]), "\"", NULL);
+ }
return TCL_ERROR;
}
return TCL_OK;