summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpspjuth <peter.spjuth@gmail.com>2011-04-22 18:24:21 (GMT)
committerpspjuth <peter.spjuth@gmail.com>2011-04-22 18:24:21 (GMT)
commit857d165d9662ecd2659b4894b8655d91487bb14a (patch)
tree6d17f823dc66eb53358a709b288da44d6a0922b9
parent98c7dcb18c3549b5f1a87d8e23f2c656bea467e5 (diff)
parent241ce388b466cd9ccd0c7ab90aa1a5c3e2fb3f09 (diff)
downloadtk-857d165d9662ecd2659b4894b8655d91487bb14a.zip
tk-857d165d9662ecd2659b4894b8655d91487bb14a.tar.gz
tk-857d165d9662ecd2659b4894b8655d91487bb14a.tar.bz2
[Bug 3291543] There was a crash if dchars removed all coordinates of a polygon.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tkCanvPoly.c1
-rw-r--r--tests/canvas.test8
3 files changed, 14 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9ce6005..8414253 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-22 Peter Spjuth <peter.spjuth@gmail.com>
+
+ * 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 <peter.spjuth@gmail.com>
* doc/checkbutton.n: Document all variable options as global.
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index b043aad..01eeb26 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.c
@@ -1198,6 +1198,7 @@ PolygonDeleteCoords(
polyPtr->numPoints = 0;
if (polyPtr->coordPtr != NULL) {
ckfree(polyPtr->coordPtr);
+ polyPtr->coordPtr = NULL;
}
ComputePolygonBbox(canvas, polyPtr);
return;
diff --git a/tests/canvas.test b/tests/canvas.test
index 065de67..19fbbde 100644
--- a/tests/canvas.test
+++ b/tests/canvas.test
@@ -526,6 +526,14 @@ test canvas-11.2 {canvas poly overlap fill check, bug 226357} -setup {
.c itemconfig 1 -width 8
lappend result [.c find over 45 50 45 50]; # outside poly
} -result {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} -setup {
destroy .c