From 83af76de9c81339f45ac8abbf7b7fae77de40220 Mon Sep 17 00:00:00 2001 From: pspjuth Date: Fri, 22 Apr 2011 18:17:47 +0000 Subject: [Bug 3291543] There was a crash if dchars removed all coordinates of a polygon. --- ChangeLog | 5 +++++ generic/tkCanvPoly.c | 1 + tests/canvas.test | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2729e5d..cb637a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-04-22 Peter Spjuth + + * generic/tkCanvPoly.c: [Bug 3291543] There was a crash if dchars + * tests/canvas.test: removed all coordinates of a polygon. + 2011-04-21 Peter Spjuth * doc/checkbutton.n: Document all variable options as global. diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index 798576b..96867a8 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -1187,6 +1187,7 @@ PolygonDeleteCoords(canvas, itemPtr, first, last) polyPtr->numPoints = 0; if(polyPtr->coordPtr != NULL) { ckfree((char *) polyPtr->coordPtr); + polyPtr->coordPtr = NULL; } ComputePolygonBbox(canvas, polyPtr); return; diff --git a/tests/canvas.test b/tests/canvas.test index ed470f9..f62eb2e 100644 --- a/tests/canvas.test +++ b/tests/canvas.test @@ -382,6 +382,14 @@ test canvas-11.2 {canvas poly overlap fill check, bug 226357} { .c itemconfig 1 -width 8 lappend result [.c find over 45 50 45 50]; # outside poly } {1 1 {} 1 {} 1 1 {} 1 {} 1} +test canvas-11.3 {canvas poly dchars, bug 3291543} { + # This would crash + destroy .c + pack [canvas .c] + .c create polygon 0 0 0 10 10 0 + .c dchars 1 2 end + .c coords 1 +} {} test canvas-12.1 {canvas mm obj, patch SF-403327, 102471} { destroy .c -- cgit v0.12