Tk Source Code

Check-in [5df336a5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[Bug 3291543] There was a crash if dchars removed all coordinates of a polygon.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5df336a562b4333139344216c19bacfe2b083ba0
User & Date: pspjuth 2011-04-22 18:24:21
Context
2011-04-25
06:47
Converted #ifdef out to use a never-defined symbol so that it is clear that two pieces of code are related. (The guarded code doesn't compile.) check-in: 2d09a336 user: dkf tags: trunk
2011-04-24
22:13
Canvas polygon experiment. This commit puts current behaviour into tests, while fixing a few crashing cases. check-in: e36fef63 user: pspjuth tags: pspjuth-canvas
2011-04-22
18:24
[Bug 3291543] There was a crash if dchars removed all coordinates of a polygon. check-in: 5df336a5 user: pspjuth tags: trunk
18:21
[Bug 3291543] There was a crash if dchars removed all coordinates of a polygon. check-in: 7262cbf0 user: pspjuth tags: core-8-5-branch
2011-04-21
23:03
merge-mark check-in: 1dcdcb18 user: jan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.






1
2
3
4
5
6
7





2011-04-21  Peter Spjuth  <[email protected]>

	* doc/checkbutton.n: Document all variable options as global.
	* doc/radiobutton.n:
	* doc/listbox.n:
	* doc/menu.n:
	* doc/options.n:
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
2011-04-22  Peter Spjuth  <[email protected]>

	* 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  <[email protected]>

	* doc/checkbutton.n: Document all variable options as global.
	* doc/radiobutton.n:
	* doc/listbox.n:
	* doc/menu.n:
	* doc/options.n:

Changes to generic/tkCanvPoly.c.

1194
1195
1196
1197
1198
1199
1200

1201
1202
1203
1204
1205
1206
1207
	count += length;
    }

    if (count >= length) {
	polyPtr->numPoints = 0;
	if (polyPtr->coordPtr != NULL) {
	    ckfree(polyPtr->coordPtr);

	}
	ComputePolygonBbox(canvas, polyPtr);
	return;
    }

    if (last >= first) {
	for (i=last+2; i<length; i++) {







>







1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
	count += length;
    }

    if (count >= length) {
	polyPtr->numPoints = 0;
	if (polyPtr->coordPtr != NULL) {
	    ckfree(polyPtr->coordPtr);
	    polyPtr->coordPtr = NULL;
	}
	ComputePolygonBbox(canvas, polyPtr);
	return;
    }

    if (last >= first) {
	for (i=last+2; i<length; i++) {

Changes to tests/canvas.test.

522
523
524
525
526
527
528








529
530
531
532
533
534
535
    lappend result [.c find over 60 40 60 40];	# top-center point
    lappend result [.c find over 0 0 0 0];	# not on poly
    lappend result [.c find over 60 60 60 60];	# center-point
    lappend result [.c find over 45 50 45 50];	# outside poly
    .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-12.1 {canvas mm obj, patch SF-403327, 102471} -setup {
    destroy .c
    pack [canvas .c]
} -body {
    set qx [expr {1.+1.}] 
    # qx has type double and no string representation 







>
>
>
>
>
>
>
>







522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
    lappend result [.c find over 60 40 60 40];	# top-center point
    lappend result [.c find over 0 0 0 0];	# not on poly
    lappend result [.c find over 60 60 60 60];	# center-point
    lappend result [.c find over 45 50 45 50];	# outside poly
    .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
    pack [canvas .c]
} -body {
    set qx [expr {1.+1.}] 
    # qx has type double and no string representation