| Ticket UUID: | 6b22d436aa80f45f0a7028244012698570c7039e | |||
| Title: | Treeview ActivateHeading Binding Fails After Widget Deletion | |||
| Type: | Bug | Version: | 8.6.8 | |
| Submitter: | anonymous | Created on: | 2018-10-31 22:51:01 | |
| Subsystem: | 01. Bindings | Assigned To: | fvogel | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2018-11-04 15:14:57 | |
| Resolution: | Fixed | Closed By: | fvogel | |
| Closed on: | 2018-11-04 15:14:57 | |||
| Description: |
The ttk::treeview::ActivateHeading procedure in the treeview bindings file tracks the active treeview widget. However when it is deleted, the variable may contain a now obsolete widget path. This will cause future calls to fail. The fix is to check if the widget still exists prior to use. Change "if {$State(activeHeading) != {}}" to "if {[winfo exists $State(activeWidget)] && $State(activeHeading) ne {}}".
| |||
| User Comments: |
fvogel added on 2018-11-04 15:14:57:
Merged to core-8-6-branch and trunk. Thanks again! fvogel added on 2018-11-01 22:07:26: Thanks, due credit given in the commit log! anonymous added on 2018-11-01 21:53:45: Sure, my name is Brian O'Hagan. fvogel added on 2018-11-01 21:40:47: Forgot to mention this: let me know by which name I can credit you in the commit message, or if you prefer not to be mentioned. fvogel added on 2018-11-01 21:36:01: Very nice and clear test script, very demonstrative, many thanks! I have committed your patch as [13ecde13a1] in a bugfix branch. Indeed it fixes the error triggered by your demo script. I think the patch is correct, with no side effect. anonymous added on 2018-11-01 18:47:17: Sorry, use this instead:
package require Tk
# Create treeview widgets
set tree1 [::ttk::treeview .tree1 -show headings -columns [list First Second Third]]
grid $tree1
set item1 [$tree1 insert {} end -id I1 -values [list Item1a Item1b Item1c]]
set tree2 [::ttk::treeview .tree2 -show headings -columns [list First Second Third]]
grid $tree2
set item2 [$tree2 insert {} end -id I2 -values [list Item2a Item2b Item2c]]
# Check for bug
proc check {tree1 tree2} {
# Move cursor to activate binding
event generate $tree2 <Motion> -x 10 -y 10 -warp 1
event generate $tree2 <Motion> -x 12 -y 12 -warp 1
# Create error condition
after 2000
destroy $tree2
# Move cursor to trigger error
event generate $tree1 <Motion> -x 15 -y 15 -warp 1
}
after 2000 [list check $tree1 $tree2]
anonymous added on 2018-11-01 18:23:21: Try this:
package require Tk
# Create treeview widgets
set tree1 [::ttk::treeview .tree1 -show headings -columns [list First Second Third]]
grid $tree1
set item1 [$tree1 insert {} end -id I1 -values [list Item1a Item1b Item1c]]
set tree2 [::ttk::treeview .tree2 -show headings -columns [list First Second Third]]
grid $tree2
set item2 [$tree2 insert {} end -id I2 -values [list Item2a Item2b Item2c]]
# Check for bug
proc check {tree1 tree2} {
# Move cursor to activate binding
event generate $tree2 <Motion> -x 10 -y 10 -warp 1
event generate $tree2 <Motion> -x [incr x] -y [incr y] -warp 1
# Create error condition
after 2000
destroy $tree2
# Move cursor to trigger error
event generate $tree1 <Motion> -x $x -y $y -warp 1
}
after 2000 [list check $tree1 $tree2]
fvogel added on 2018-11-01 12:35:19: I think I see what you mean, but can you show a short script demonstrating the problem please? I tried but failed. | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki