From 996aa5aa5d6fca18e46c0f25c7f25589a1d85003 Mon Sep 17 00:00:00 2001 From: hobbs Date: Sun, 11 May 2003 00:57:09 +0000 Subject: * generic/tkCanvPoly.c (PolygonToPostscript): * tests/canvPs.test: correct crash when generating postscript for a single-line polygon (point) with no color. [Bug #734498] (wilm) --- ChangeLog | 6 ++++++ generic/tkCanvPoly.c | 9 ++++++--- tests/canvPs.test | 22 ++++++++-------------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 21a7b87..3f23e28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-05-10 Jeff Hobbs + + * generic/tkCanvPoly.c (PolygonToPostscript): + * tests/canvPs.test: correct crash when generating postscript for + a single-line polygon (point) with no color. [Bug #734498] (wilm) + 2003-04-30 Jeff Hobbs * macosx/tkMacOSXButton.c (TkpDisplayButton): correct typo for diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index 5058b9f..2b5f036 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.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: tkCanvPoly.c,v 1.10 2003/02/09 07:48:22 hobbs Exp $ + * RCS: @(#) $Id: tkCanvPoly.c,v 1.10.2.1 2003/05/11 00:57:09 hobbs Exp $ */ #include @@ -1852,13 +1852,16 @@ PolygonToPostscript(interp, canvas, itemPtr, prepass) } if (polyPtr->numPoints==2) { char string[128]; + if (color == NULL) { + return TCL_OK; + } + sprintf(string, "%.15g %.15g translate %.15g %.15g", polyPtr->coordPtr[0], Tk_CanvasPsY(canvas, polyPtr->coordPtr[1]), width/2.0, width/2.0); Tcl_AppendResult(interp, "matrix currentmatrix\n",string, " scale 1 0 moveto 0 0 1 0 360 arc\nsetmatrix\n", (char *) NULL); - if (Tk_CanvasPsColor(interp, canvas, color) - != TCL_OK) { + if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) { return TCL_ERROR; } if (stipple != None) { diff --git a/tests/canvPs.test b/tests/canvPs.test index 8ab93a0..cc0f39b 100644 --- a/tests/canvPs.test +++ b/tests/canvPs.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: canvPs.test,v 1.5 2002/10/10 07:25:24 hobbs Exp $ +# RCS: @(#) $Id: canvPs.test,v 1.5.2.1 2003/05/11 00:57:10 hobbs Exp $ package require tcltest 2.1 namespace import -force tcltest::configure @@ -124,22 +124,16 @@ test canvPs-3.2 {test ps generation with an embedded window not mapped} {} { file exists bar.ps } 1 +test canvPs-4.1 {test ps generation with single-point uncolored poly, bug 734498} {} { + destroy .c + pack [canvas .c] + .c create poly 10 20 10 20 + catch {.c postscript} +} 0 + # cleanup removeFile foo.ps removeFile bar.ps deleteWindows ::tcltest::cleanupTests return - - - - - - - - - - - - - -- cgit v0.12