summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2024-07-06 09:08:23 (GMT)
committerfvogel <fvogelnew1@free.fr>2024-07-06 09:08:23 (GMT)
commit20e845f8ee2d82ceef1c6ec9511a9ef499d09634 (patch)
tree67b40cda483cb72bb4fc33a95794513ea54aeba8
parent875543b761fc2bf80c6e0a6ee7fc28a0899513ff (diff)
parent72d3efa9db1388bc4db29755b1d1befe33b457a0 (diff)
downloadtk-20e845f8ee2d82ceef1c6ec9511a9ef499d09634.zip
tk-20e845f8ee2d82ceef1c6ec9511a9ef499d09634.tar.gz
tk-20e845f8ee2d82ceef1c6ec9511a9ef499d09634.tar.bz2
Fix [51ece3786f]: crash with dchars on line with arrows.
-rw-r--r--generic/tkCanvLine.c4
-rw-r--r--tests/canvas.test7
2 files changed, 9 insertions, 2 deletions
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index a001677..408ef7c 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -700,10 +700,10 @@ ComputeLineBbox(
width = 1.0;
}
if (linePtr->arrow != ARROWS_NONE) {
- if (linePtr->arrow != ARROWS_LAST) {
+ if (linePtr->arrow != ARROWS_LAST && linePtr->firstArrowPtr) {
TkIncludePoint((Tk_Item *) linePtr, linePtr->firstArrowPtr);
}
- if (linePtr->arrow != ARROWS_FIRST) {
+ if (linePtr->arrow != ARROWS_FIRST && linePtr->lastArrowPtr) {
TkIncludePoint((Tk_Item *) linePtr, linePtr->lastArrowPtr);
}
}
diff --git a/tests/canvas.test b/tests/canvas.test
index 1224516..e8a3951 100644
--- a/tests/canvas.test
+++ b/tests/canvas.test
@@ -530,6 +530,13 @@ test canvas-11.3 {canvas poly dchars, bug 3291543} {
.c dchars 1 2 end
.c coords 1
} {}
+test canvas-11.4 {canvas line dchars crash with -arrows, bug 51ece3786f} {
+ # This would crash
+ destroy .c
+ canvas .c
+ .c create line 10 10 100 100 -arrow last
+ .c dchars 1 0 1
+} {}
test canvas-12.1 {canvas mm obj, patch SF-403327, 102471} -setup {
destroy .c